A 7-billion-parameter decoder, fine-tuned for under 1,000 steps, beat every English embedder in early 2024: 66.6 on MTEB against 64.2. On Indic languages, a model 12.5 times smaller beats it by 10 points.
Pick where you test, from English to Indic. Watch the gap between the decoder and the best encoder change sign. Then we build, piece by piece, last-token pooling, instructions, synthetic data, the InfoNCE loss, LoRA, and the benchmark that found the flip.
You need a little Python and what a probability is. We build the rest from zero.
Session 2 of Georgia Tech CS 8803, LLM seminar. It rests on two papers: Wang, Yang, Huang, Yang, Majumder and Wei, Improving Text Embeddings with Large Language Models (ACL 2024, "E5-Mistral"), and Enevoldsen, Chung, Kerboua, Kardos and many co-authors, MMTEB: Massive Multilingual Text Embedding Benchmark (ICLR 2025). Every idea is re-taught here in our own words and devices.
The papers' numbers. English: E5-Mistral (7B) against BGE-large-en-v1.5 (335M), E5-Mistral Table 1. MIRACL: E5-Mistral against multilingual-e5-large, nDCG@10 averaged over en, fr, es, ru or te, hi, bn, sw, E5-Mistral Table 2. Europe, Multilingual, Indic: e5-mistral-7b-instruct against multilingual-e5-large-instruct (560M), average across all tasks, MMTEB Table 2.
Chapter 0
See why a retrieval system needs good vectors, and why the old way to make them ran out of data
You build a support assistant over 10,000 pages of documentation. A customer asks a question. First the system must find the three paragraphs that answer it. Then it must write a reply from them. This is retrieval-augmented generation (RAG).
The finding step uses text embeddings. An embedding is a fixed-length vector for a piece of text, made so that texts with close meanings get vectors that point the same way. You embed every paragraph once. At query time you embed the question and return the paragraphs with the highest cosine similarity, the cosine of the angle between two vectors. If cosine is new to you, Vector Embeddings and Similarity Metrics build it from zero.
How big is the index? Call the number of paragraph chunks N, the length of each vector d, and the bytes per number b.
The index bytes equal N times d times b.
Multiply the number of chunks N by the numbers per vector d. Multiply by the bytes b for each number.
With made-up corpus numbers: N = 40,000, d = 4,096, b = 2 gives 327,680,000 bytes, about 328 MB. With d = 1,024 it is 82 MB. Both fit in a laptop's memory.
Drag the corpus size and pick a vector length. The bar is the index; the grey mark is the 14 GB that a 7B model's weights take at 16 bits.
Arithmetic only. The 4,096 dimensions are from the E5-Mistral paper's Limitations; 7 billion parameters at 2 bytes is 14 GB.
Storing vectors is cheap. Making good ones is the hard part. Before 2024 the best embedders were small bidirectional encoders (BERT-style models where every token sees every other token). They trained in two stages: contrastive pretraining on billions of weakly related web pairs, then fine-tuning on labeled datasets.
The limit was data, not the model. Instructor trained on 330 datasets, all English. BGE focused on English and Chinese. Each new task or language needed someone to collect a labeled set first.
Failure. Your assistant works in English and returns poor paragraphs in Swahili. Measure: score retrieval separately per language. Fix: a model whose training data and pretraining cover that language. Chapters 7 to 9 show how large this gap gets.
Chapter 1
Collapse one vector per token into one vector per text, and see why a decoder must read the last token
A transformer gives one hidden vector per token. A retriever needs one vector per text. The step that collapses N token vectors into one is pooling.
For a bidirectional encoder, the usual choice is mean pooling: average the N vectors. That is fair there, because every position has read the whole text.
A decoder is different. It uses causal attention: the token at position i may look only at positions 0 to i. Its coverage, the share of the text it has read, is (i + 1) / N. Only the last position has read everything.
Left: the causal mask. A lit cell means the row's token may read the column's token. Right: each position's coverage. Drag the length, then switch the pooling.
Counting only, inside one attention layer. Deeper layers pass information forward, which is why the measured gap is small.
What does mean pooling average over, on the whole? Call the number of tokens N, and a position i, from 0 to N − 1.
The average coverage equals one over N times the sum over i of i plus one over N, which equals N plus one, over two N.
Give each position i its coverage (i + 1)/N. Average them over the N positions. The result is (N + 1)/(2N), which falls toward one half as N grows.
N = 8: (8 + 1)/16 = 0.5625, so the mean averages vectors that saw 56% of the text. N = 32: 33/64 = 0.516. Last-token pooling reads one vector with coverage 1 at any N.
E5-Mistral appends an end-of-sequence token, [EOS], and takes its last-layer vector. This is last-token pooling. During pretraining this position summed up everything before it to predict the next token, so the skill is already there.
The paper tested the choice with everything else fixed (Table 5, MTEB average over 56 English datasets): last token 64.5, mean 64.1, weighted mean 64.0. The gap is small, because deep layers carry early tokens forward.
Failure. You pad a batch on the right, and the code takes hidden[:, -1]. Every short text gets the vector of a padding token. Training still runs, so nothing looks wrong. Measure: print the index of each row's real last token. Fix: pad on the left, or gather at mask.sum(1) - 1.
Chapter 2
Put a one-sentence task description in front of the query, leave the documents alone, and measure what it buys
"Apple" should land near fruit for a recipe search and near phones for a tech search. One vector cannot serve both. E5-Mistral lets the caller say which task it is.
The model wraps every query in a template before it embeds it:
The task definition is one sentence, for example "Given a web search query, retrieve relevant passages that answer the query". For synthetic data the sentence comes from the brainstorm step of Chapter 3. For datasets such as MS-MARCO, the authors wrote one by hand.
Documents get no wrapper. So you embed the corpus once and keep it. A new task needs only a new sentence on the query side, not a new index.
Pick an instruction setting. The box shows the string the model reads; the bars show the seven MTEB categories against the default (outline).
E5-Mistral Table 5, trained on synthetic data plus MS-MARCO passages. The tag setting uses "classify: " for long-short tasks and "query: " for the other asymmetric tasks (Appendix A). The example query is ours.
Read the averages: a sentence gives 64.5, a tag 60.3, nothing 60.3. Deleting the sentence costs 4.2 points, which is (64.5 − 60.3)/64.5 = 6.5% of the score. Swapping Mistral-7B for LLaMA-2-7B costs only 1.6. The tag even helps retrieval a little (52.7 against 52.2) but loses classification, clustering and STS. A decoder reads sentences; a tag is a rare token with little meaning.
Failure. You serve a model trained with instructions but embed queries without them. Scores drop with no error message. Measure: embed a dev set both ways and compare recall. Fix: keep a table of one instruction per task and apply it at query time.
Chapter 3
Let a strong LLM write the training pairs, and split the prompt in two so the data does not repeat itself
A training example for an embedder is a triple: a query, a positive document that answers it, and a hard negative, a document that looks relevant but is not. E5-Mistral asks GPT-4 to write these triples instead of collecting them.
Ask in one prompt, "write a query and a matching document", and the model repeats its most likely ideas. The paper tried this and found the diversity "not as satisfactory". So it splits the prompt in two:
Each cell is one of 40 possible task types. A one-step generator keeps picking its favourites. A two-step generator samples from its brainstormed list. Press Generate and count the lit cells.
Toy sampler, ours: the one-prompt generator draws from a steep made-up preference; the two-step one draws a fresh list of 20 tasks, then picks from it. The paper reports only that one prompt gave less diverse data.
The random settings stretch each task further. The query length is one of "less than 5 words", "5 to 10 words" or "at least 10 words". The sampler draws the language from XLM-R's language list, weighted toward high-resource languages.
Tasks come in two families. Asymmetric tasks pair texts that relate but do not mean the same: short-long (web search), long-short (classification), short-short and long-long. Symmetric tasks pair texts with the same meaning: monolingual similarity (STS) and bitext, the same sentence in two languages. Symmetric tasks skip the brainstorm; the task is already clear.
| Quantity | Value | Worked out |
|---|---|---|
| Examples | 500,000 | from 150,000 task sentences: 3.3 per sentence |
| Generator | 25% GPT-3.5-Turbo | 125,000 from GPT-3.5, the rest from GPT-4 |
| Tokens used | about 180M | about 360 per example |
| Languages | 93 | English 43.1%; the bottom 75 about 1,000 each, 15% in total |
Is it worth it? Train on MS-MARCO alone: 62.7. Add the synthetic data: 64.5 (Table 5). With synthetic data and no labeled data at all: 63.1 (Table 1).
Failure. Generated pairs pile up in the languages the sampler favours. Measure: count examples per language before training. Fix: reweight the language sampler, and expect the base model's own pretraining to limit what the fine-tune can add.
Chapter 4
Score the right document against the wrong ones, and see how the temperature sharpens the contest
Training moves the query vector toward its positive and away from every negative. The loss treats retrieval as a multiple-choice test: pick the right document from all of them. Contrastive Learning covers the family.
First, a score for one query and one document. Call the query's embedding hq, the document's hd, and a small constant called the temperature τ.
Phi of q and d equals e to the power of: the cosine of h-q and h-d, divided by tau.
Take the cosine of the two embeddings. Divide it by tau. Raise e to that power. The result phi is large when the two vectors agree.
With made-up numbers: cosine 0.9 and tau 0.5 give exp(1.8) = 6.05. Cosine 0 gives exp(0) = 1.00. Cosine −0.5 gives exp(−1) = 0.37.
Call the positive document d+ and the set of negatives N, with one negative written n.
L equals minus the log of: phi of q and d-plus, divided by phi of q and d-plus plus the sum over n in N of phi of q and n.
Score the positive and every negative with phi. Divide the positive's score by the total. That share is the probability of picking the right document. The loss L is minus its log.
With the scores above: 6.05 / (6.05 + 1.00 + 0.37) = 6.05 / 7.42 = 0.816, so L = −log 0.816 = 0.204. Drop the positive's cosine to 0.3: exp(0.6) = 1.82, the share is 1.82 / 3.19 = 0.571, and L = 0.560. A worse positive costs 2.7 times the loss.
The teal bar is the positive, the pink bar the hard negative, the grey bars easy negatives. Bar height is each document's share. Lower the temperature and watch a 0.02 cosine gap decide the contest.
Toy cosines, ours: one positive, one hard negative and six easy negatives at cosine 0.5. The real batch has 2,047 in-batch negatives and one hard negative per query; τ = 0.02 is the paper's.
In-batch negatives are free: in a batch of 2,048 pairs, every other pair's positive is a negative. Hard negatives are mined: where a dataset has none, the authors took non-answers from multilingual-e5-base's top 100.
Why τ = 0.02? Cosines lie between −1 and 1. Dividing by 0.02 turns a gap of 0.02 into a gap of 1 in the exponent. In the device at τ = 0.5, the positive ranks first but gets a share of only 0.40; at 0.02 it gets 0.73.
Failure. The loss stalls and retrieval stays mediocre. Measure: how many negatives score near the positive. Fix: add mined hard negatives, and check none is a true answer.
Chapter 5
Freeze the 7 billion weights, train a small correction beside each matrix, and count the run's steps and GPUs
Training all 7 billion weights of Mistral-7B on 1.8 million pairs is costly. It also risks overwriting what pretraining built. LoRA (Low-Rank Adaptation) freezes every weight matrix and learns a small correction beside it. The full story is in LoRA and PEFT.
Call a frozen weight matrix W, with din inputs and dout outputs. LoRA adds two thin trainable matrices: A, with r rows, and B, with r columns. The small number r is the rank.
W-prime equals W plus B times A. The trainable count is r times d-in plus d-out.
Keep W fixed. Train A and B. Add their product to W. The trainable count grows with the sum of the two sides, not their product.
Mistral's query projection is 4,096 by 4,096: 16,777,216 frozen numbers. At r = 16, A and B hold 16 × (4,096 + 4,096) = 131,072, which is 0.8% of W.
Each row is one of the seven linear layers in a Mistral-7B block, with its shape. The bar is its LoRA size. Change the rank and read the total over 32 blocks and the MTEB score.
Shapes from the public Mistral-7B-v0.1 config (hidden 4,096, MLP 14,336, key and value 1,024). Our count at r = 16 is 41.9M, matching the paper's 42M. MTEB averages: Table 5 (r = 64 was not run).
Sum the seven layers of one block: 16 × 81,920 = 1,310,720. Times 32 blocks: 41,943,040, the paper's 42M. Against about 7.2 billion weights that is 0.6%. Rank barely matters: r = 8 gives 64.8, r = 16 gives 64.5, r = 32 gives 64.6. The authors kept 16.
The run, from Appendix A: one epoch over about 1.8M examples, batch 2,048, so 1,800,000 / 2,048 = 879 steps, "fewer than 1k". Learning rate 10−4 with 100 warm-up steps, weight decay 0.1, sequences up to 512 tokens. It took about 18 hours on 32 V100 GPUs, 64 examples per GPU per step.
Failure. A GPU runs out of memory, even though only 42M weights train. The frozen 7B weights and the activations still have to live somewhere. Measure: memory per GPU at batch 64. Fix: what the paper used, gradient checkpointing, mixed precision and DeepSpeed ZeRO-3, which splits weights and optimizer state across the 32 GPUs.
Chapter 6
Test the contrastive pretraining stage on an encoder and on a decoder, and see why only one of them needs it
Every strong embedder before this one had a middle stage: contrastive pretraining on billions of weak pairs, such as a page title with its body. E5 and BGE relied on it. Section 5.1 of the paper asks whether a decoder LLM still needs it.
The test: train two backbones on the same fine-tuning data, each with and without the extra stage. For Mistral, the stage followed the multilingual E5 recipe for 10,000 steps, about 11 times the 879 fine-tuning steps.
Pick a backbone. Solid bars are with contrastive pretraining; outlines are without. Read the gain above each pair.
E5-Mistral Table 7 and Figure 3, both backbones trained on the full data mix.
| Backbone | Retrieval | MTEB average |
|---|---|---|
| XLM-R-large, without → with | 42.0 → 50.2 (+8.2) | 58.0 → 63.7 (+5.7) |
| Mistral-7B, without → with | 56.9 → 56.9 (+0.0) | 66.6 → 66.7 (+0.1) |
Why the difference? Compare what each model practised. A masked language model such as XLM-R fills in a hidden word from the words around it. It never has to sum up a whole text, and never compares two texts. The extra stage teaches that.
A decoder predicts the next token, trillions of times. To do that well it must keep a running summary of what the text is about, at every position. That summary is what last-token pooling reads. So fine-tuning does not teach meaning. It reshapes a space that already holds meaning, so that cosine distance tracks relevance. That is a small job, which is why 0.6% of the weights and 879 steps suffice.
The paper's words: generative language modeling and text embeddings are "two sides of the same coin".
Failure. You copy the encoder recipe to a decoder and spend weeks on a pretraining stage. Measure: run a small ablation first, with and without the stage, on the same fine-tuning data. Fix: drop the stage if the gain is under noise.
Chapter 7
Read the English leaderboard, then split the multilingual results by language and watch the lead turn into a deficit
On MTEB, 56 English datasets in seven task categories, E5-Mistral with the full data scored 66.6. The best earlier model, BGE-large-en-v1.5, scored 64.2 (Table 1). The full data is the synthetic set plus 13 public datasets.
| Model or setting | MTEB average | Note |
|---|---|---|
| BGE-large-en-v1.5 | 64.2 | best earlier model, about 335M parameters |
| E5-Mistral, synthetic only | 63.1 | no labeled data at all |
| E5-Mistral, synthetic + MS-MARCO | 64.5 | +1.4 from one labeled set |
| E5-Mistral, full data | 66.6 | +2.1 more from 12 further sets |
On BEIR, the 15 retrieval datasets inside MTEB, it scored 56.9 against 55.6 for the best commercial model listed, voyage-lite-01-instruct (Table 3). That is (56.9 − 55.6)/55.6 = 2.3% better. A real win, but a narrow one. The table changed between versions: version 1 compared against OpenAI Ada-002, and version 3 against text-embedding-3-large (55.4).
Now leave English. MIRACL is a retrieval benchmark where native speakers wrote queries and judged answers in 18 languages. Its score, nDCG@10, rewards putting the right passages near the top of the first ten; Embedding Benchmarks derives it by hand.
Each pair is one language: teal is E5-Mistral, blue is multilingual-e5-large, an XLM-R encoder. Switch between the languages and the two group averages.
E5-Mistral Table 2, nDCG@10 on the MIRACL dev set. The authors picked the four languages with the most and the fewest candidate documents.
Average the four high-resource languages (en, fr, es, ru): E5-Mistral (57.3 + 55.2 + 52.2 + 67.7)/4 = 58.1, multilingual-e5-large 56.9. A lead of 1.2. Average the four low-resource languages (te, hi, bn, sw): 66.2 against 74.4. A deficit of 8.2. Inside the small group, E5-Mistral spans 52.1 on Hindi to 73.9 on Telugu.
The paper names the cause: Mistral-7B "is predominantly pre-trained on English data". Its own bitext results say the same: it "excels in bitext mining for high-resource languages only". XLM-R, under multilingual-e5, was pretrained on 100 languages. Touching 93 languages in a fine-tune does not undo pretraining on mostly English.
Failure. You pick the model with the best average and your Hindi users get the worst results. Measure: report per-language scores, not one average. Fix: choose on the languages you serve.
Chapter 8
Gather 500+ tasks, cut them to the ones that add new information, and make the whole thing cheap enough to run
An MTEB score is a claim about English. MMTEB is the multilingual answer: over 500 tasks in 10 task categories and 250+ languages, built by an open collaboration on GitHub. New task types include instruction-following retrieval, long-document retrieval and code retrieval.
Every task passed a gate: two small models, multilingual-e5-small and MiniLM-L12, ran on it. A score within 2% of random, a near-perfect score, or two near-equal scores sent it to a reviewer.
From the pool the authors built smaller benchmarks (Table 1). They picked a scope, removed machine-translated or badly licensed sets, then dropped tasks that add little information.
| Benchmark | Scope | Refined | Selected |
|---|---|---|---|
| MTEB(Multilingual) | 500+ | 343 | 132 |
| MTEB(Europe) | 420 | 228 | 74 |
| MTEB(Indic) | 55 | 44 | 23 |
| MTEB(eng, v2), zero-shot | 56 | 54 | 41 |
The last step is backward selection. Predict each task's scores from the other tasks with a linear regression. Remove the easiest one to predict. Stop when the best prediction's rank agreement falls below 0.8 (0.9 for eng v2). Never remove a language's last task in a category.
The ruler for "do two rankings agree" is Spearman's rank correlation. Call the number of models n, and for model i the difference between its two ranks di.
Rho equals one minus six times the sum over i of d-i squared, divided by n times n squared minus one.
Rank the models twice, once on the full test and once on the cheap one. For each model, square the change in rank d-i. Add the squares, multiply by 6, divide by n(n² − 1), and take the result from 1.
With made-up ranks: four models, ranked 1, 2, 3, 4 on the full test and 1, 3, 2, 4 on the cheap one. The d-i are 0, 1, 1, 0, so the sum of squares is 2. ρ = 1 − 12/60 = 0.8. One swap in the middle costs 0.2.
Cost was the other problem. MTEB(eng, v1) takes up to two days on one A100 for a mid-sized LLM; the E5-Mistral authors report three days on 8 V100s. So MMTEB cut the documents to embed, and checked each cut with Spearman.
Pick a cut. The bars compare the work before and after, on a log scale. The read-out says what was checked.
MMTEB Sections 2.3 and 4. Clustering is drawn as relative work (1 before, 1/16.11 after), since the paper reports a speed-up.
| Cut | How | Result |
|---|---|---|
| Clustering | encode a 4% subsample once, draw 10 sets from it | 16.11× faster on average, Spearman 0.96 |
| Retrieval | keep the top 250 documents per query from BM25, multilingual-e5-large and e5-mistral; at most 1,000 queries | largest sets from over 5 million documents to at most 250,000 |
| Bitext | cache each sentence's embedding across language pairs | Flores English side: 410,000 to 1,012 embeddings |
| eng v2 | all of the above, plus task selection, zero-shot | 2% of the documents; 3.11 h for GritLM-7B on one H100; Spearman 0.90 with v1 |
MTEB(eng, v2) drops MS-MARCO and Natural Questions, because many models, E5-Mistral included, train on them. The small English models trained on both score lower on v2.
Failure. A cheap test ranks models in a new order. Measure: Spearman between cheap and full rankings on reference models. Fix: keep the cut only if the order holds.
Chapter 9
Rank 12 models on three benchmarks and watch the 7B decoders fall from the top to sixth
MMTEB ranks models with a Borda count, a voting rule. Each task is a voter that ranks every model. A model gets points on each task for the models it beats. Points add up over tasks. One task with an odd score scale then cannot swing the result, as it could swing a plain average.
Call the number of models M, a task t, and model m's place on task t rankt(m).
Borda of m equals the sum over t of M minus rank-t of m.
On each task t, give model m one point for every model ranked below it, which is M minus its rank. Add the points over all tasks.
With made-up ranks: M = 3 models and two tasks. X is first then third: 2 + 0 = 2. Y is second then first: 1 + 2 = 3. Z is third then second: 0 + 1 = 1. Y wins, though X won a task. The paper breaks ties with the tournament Borda method.
Teal: Mistral-7B decoders. Blue: XLM-R multilingual-e5 encoders. Grey: other encoders, dim grey for English-only models. Pick a benchmark, then switch the order between Borda rank and average score.
MMTEB Table 2: Borda rank, Borda points and average across all tasks.
| Benchmark | multilingual-e5-large-instruct (560M) | GritLM-7B | e5-mistral-7b-instruct |
|---|---|---|---|
| Multilingual, 132 tasks | 1st, 63.2 | 2nd, 60.9 | 3rd, 60.3 |
| Europe, 74 tasks | 2nd, 62.2 | 1st, 63.0 | 3rd, 61.7 |
| Indic, 23 tasks | 1st, 70.2 | 5th, 60.2 | 6th, 60.0 |
On Indic, all four multilingual-e5 models, even the small one, rank above both 7B decoders. The paper finds the decoders' rank "steadily decreases and becomes more volatile" as a language's native speakers drop, most clearly below about 300 million speakers.
One choice does carry across languages: instruction tuning. multilingual-e5-large-instruct beats multilingual-e5-large by 4.6 on Multilingual, 3.7 on Europe and 3.8 on Indic. GritLM keeps one real edge, the best retrieval score on MTEB(Multilingual), helped by its longer maximum input.
Order Indic by average and two rows swap: multilingual-e5-small (64.7) edges past multilingual-e5-base (64.6), and LaBSE (61.9) passes both decoders. Borda counts wins per task; the average counts margins.
Chapter 10
Keep the terms, the numbers, the code and the limits in one place
A decoder LLM becomes a strong embedder with four parts: last-token pooling, a task instruction on the query, GPT-4-written training triples, and an InfoNCE fine-tune of 0.6% of the weights. It works because next-token pretraining already built the meaning. That recipe won English in early 2024. MMTEB showed the win does not carry to languages the base model rarely saw.
| Term | Meaning | Number to remember |
|---|---|---|
| Last-token pooling | the [EOS] vector is the embedding | 64.5 vs 64.1 for mean pooling |
| Mean-pool coverage | average share of text the averaged vectors read | (N + 1)/(2N): 0.5625 at N = 8 |
| Instruction | one task sentence before the query only | removing it: 64.5 to 60.3 |
| Synthetic data | GPT-4 and GPT-3.5 triples, two-step prompts | 500k examples, 150k tasks, 93 languages |
| InfoNCE | cross-entropy over the positive and the negatives | τ = 0.02, batch 2,048, 1 hard negative |
| LoRA | frozen W plus a trained rank-r B A | r = 16: 42M trainable, 0.6% |
| Training run | one epoch over the mix | 879 steps, about 18 h on 32 V100s |
| Contrastive pretraining | extra stage on weak pairs | XLM-R +8.2 retrieval; Mistral +0.0 |
| MIRACL split | E5-Mistral vs multilingual-e5-large | +1.2 high-resource, −8.2 low-resource |
| MMTEB | community benchmark, Borda ranking | 500+ tasks, 250+ languages; Indic: 560M model 1st, 7B decoders 5th and 6th |
pythonimport torch, torch.nn.functional as F def last_token_pool(hidden, mask): # hidden: (B, L, 4096), mask: (B, L) if mask[:, -1].all(): # left-padded: last column is real return hidden[:, -1] last = mask.sum(1) - 1 # right-padded: index of each real [EOS] return hidden[torch.arange(hidden.shape[0]), last] # (B, 4096) def with_instruction(task, query): # queries only; documents stay as they are return f"Instruct: {task}\nQuery: {query}" def info_nce(q, pos, hard, tau=0.02): # q, pos, hard: (B, d) q, pos, hard = (F.normalize(x, dim=-1) for x in (q, pos, hard)) logits = torch.cat([q @ pos.T, q @ hard.T], dim=1) / tau # (B, 2B): in-batch + hard labels = torch.arange(q.shape[0]) # row i's positive is column i return F.cross_entropy(logits, labels)
E5-Mistral: 4,096-dimensional vectors cost more to store, and a 7B model costs more to run than a BERT-size one. Long inputs: the passkey test scores 100% up to 4k tokens with the default 4k sliding window, then drops. A 32k window alone is worse. With the RoPE base raised to 105, it passes 90% at 32k, with a small loss on short inputs. The contamination check string-matched the training data against MTEB and found only 4 DBPedia questions that also appear in TriviaQA. It cannot check GPT-4's or Mistral's pretraining data, which is not public.
MMTEB lists three limits. Human-translated tasks, such as SIB200ClusteringS2S, carry English labels and may favour English-leaning models. Every dataset earned the same credit points whatever the effort. English still appears in 290 tasks, and low-resource languages sit mostly in bitext mining and classification.
Credit: Session 2 of Georgia Tech CS 8803, LLM seminar. Papers: Improving Text Embeddings with Large Language Models (Wang et al., ACL 2024, arXiv 2401.00368, version 3) and MMTEB: Massive Multilingual Text Embedding Benchmark (Enevoldsen et al., ICLR 2025, arXiv 2502.13595, version 4). The toy samplers and all made-up numbers are ours.
Teach it back: open Present or Teach and explain last-token pooling and the leaderboard flip to a friend. Then go back to the benchmark dial and predict the sign of the gap before you press each stop.