E5 Embeddings Explained: Models, Prefixes and Best Uses

E5 Embeddings Explained: Models, Prefixes and Best Uses

E5 embeddings are a family of open-weight text embedding models from Microsoft, and they are one of the most practical starting points for any team that wants strong retrieval without paying an API provider. If you are building semantic search or a retrieval-augmented generation system on your own hardware, the question is which E5 model fits your corpus, and whether a small detail, the prefix you put in front of your text, is quietly deciding your results. The short answer is that e5-large-v2 is the quality pick for English, multilingual-e5-large covers around 100 languages, and the query and passage prefixes are not optional: get them wrong and the benchmark quality you read about simply does not happen.

E5 comes from Microsoft’s paper “Text Embeddings by Weakly-Supervised Contrastive Pre-training”, and the name reflects the method: the models were trained on huge amounts of weakly labelled text pairs, then fine-tuned on smaller sets of high-quality labelled pairs. That combination is why a modestly sized model can retrieve so well. The whole family is released under the MIT licence, so you can download the weights, run them anywhere and fine-tune them on your own data at no licence cost.

Key takeaways

  • E5 embeddings are open-weight models from Microsoft, released under the MIT licence, with English, multilingual and instruction-tuned variants.
  • e5-large-v2 produces 1,024-dimensional vectors from inputs of up to 512 tokens and is the quality pick for English retrieval.
  • The prefix rule is essential: prepend “query: ” to search queries and “passage: ” to documents, or the model underperforms.
  • multilingual-e5-large covers around 100 languages at 1,024 dimensions, with an instruct variant for task-specific retrieval.
  • e5-mistral-7b-instruct is a 7-billion-parameter instruction-tuned model with 4,096 dimensions for the hardest English retrieval tasks.

What E5 embeddings are

Like all embedding models, E5 converts text into vectors that place similar meanings close together, so search can work by meaning rather than by keyword. The E5 family is built on BERT-style encoder backbones for the standard models, which keeps them small and fast, and on a large language model backbone for the instruction-tuned variant. The standard models range from 33 million to 560 million parameters, which means even the largest runs comfortably on a single GPU and the smallest runs well on CPU.

The training recipe is what made E5 notable. Instead of relying only on expensive human-labelled data, Microsoft trained on massive collections of weakly supervised pairs drawn from the web, such as titles with bodies and questions with answers, then fine-tuned on curated labelled sets. That approach gave the models broad coverage of how people actually phrase questions and documents, which is exactly the gap retrieval has to bridge.

Because the weights are open, E5 fits the same niches as other open embedders: air-gapped systems, regulated data, high-volume workloads where per-token pricing hurts, and teams that want to fine-tune on their own domain. The difference from some rivals is maturity. E5 models have been deployed, benchmarked and integrated for years, so the tooling, the quantization recipes and the failure modes are all well documented.

The E5 family at a glance

Model Parameters Dimensions Languages Best for
e5-small-v2 33 million 384 English Fast, lightweight retrieval
e5-base-v2 109 million 768 English Balanced speed and quality
e5-large-v2 335 million 1,024 English English retrieval quality
multilingual-e5-large 560 million 1,024 Around 100 Multilingual retrieval
multilingual-e5-large-instruct 560 million 1,024 Around 100 Task-specific multilingual retrieval

All five models truncate input at 512 tokens, so documents longer than roughly 350 to 400 words must be split before embedding. The English v2 models use BERT backbones, while the multilingual pair is built on XLM-RoBERTa-large, covering roughly 100 languages from that model’s pretraining corpus, with the honest caveat that low-resource languages perform worse. The instruct variant is the same size as the plain multilingual model but trained to follow task instructions, which changes how you prompt it.

The prefix rule: the detail that decides everything

Best for: every E5 deployment, because this rule applies to all of them.

For the v2 and plain multilingual models, you must prepend “query: ” to search queries and “passage: ” to documents at index time. The model was trained with those prefixes, so it expects them, and the vectors it produces without them are measurably worse. This is the single most common E5 mistake in production: a team loads the model, embeds plain text, compares it against a benchmark number, and concludes the model is weak, when the model was never given the input format it was trained on.

The instruct variant replaces the prefix scheme. Queries get a one-sentence task instruction in the format “Instruct: {task description}” followed by the query, while documents get no prefix at all. That makes the instruct model more flexible, since you can describe the retrieval task in plain language, but it also means the two variants need different code paths. Do not mix them: a pipeline built for the plain models will feed the instruct model the wrong format, and vice versa.

The practical lesson is to write the prefix logic once, test it, and put a check in your pipeline that verifies prefixes are present before embedding. It is a five-minute safeguard against a silent quality loss that no amount of tuning elsewhere will fix. The same discipline applies to chunking: with a 512-token limit, how you split documents matters, and our guide to semantic chunking for RAG explains how to keep chunks meaningful.

e5-large-v2: the English quality pick

Best for: English document search and RAG where you want the best quality in a small, fast model.

e5-large-v2 has 24 layers, 335 million parameters and a 1,024-dimensional output, and it is the model most teams mean when they say they use E5. It is large enough to capture fine distinctions between passages and small enough to embed a large corpus quickly on a single GPU. For English retrieval it has been a reference point for years, and it remains competitive against newer models that are several times its size.

The smaller siblings have clear roles. e5-small-v2, at 33 million parameters and 384 dimensions, is the pick when latency or memory dominates, such as embedding on a laptop or serving many concurrent queries on CPU. e5-base-v2, at 109 million parameters and 768 dimensions, sits in the middle and is the right choice when you need better quality than the small model but cannot afford the large one’s compute. Measure all three on your own evaluation set, because the quality gap between them is smaller on easy corpora than the parameter counts suggest.

One note on versions: the original e5-large was superseded by e5-large-v2, which performs better with the same usage pattern, so new projects should use the v2 models. If you inherit a system running the original, the migration is straightforward, since the interface is the same and only the weights change.

Two stacks of blank index cards on a wooden desk
E5 models need the right prefixes: queries get “query: ” and documents get “passage: ” before embedding.

Multilingual E5 and the Mistral variant

Best for: multilingual corpora, and the hardest English retrieval tasks where a large model is justified.

multilingual-e5-large brings E5 quality to around 100 languages in a 560-million-parameter model with 1,024-dimensional output. A global knowledge base can use one model for every language, and cross-language retrieval works: a question in English can retrieve a passage in Spanish when the two are close in vector space. The instruct variant adds task descriptions, so you can tell the model whether you are doing retrieval, classification or clustering, and it adjusts accordingly.

e5-mistral-7b-instruct is a different kind of model. Built on Mistral-7B and released in January 2024, it has around 7.1 billion parameters, a 4,096-dimensional embedding and a 4,096-token context window. It is instruction-tuned on synthetic data and fine-tuned with contrastive learning, and it scores 56.9 on the BEIR retrieval benchmark with an average MTEB score of 60.3. It is the pick when English retrieval quality matters more than model size or serving cost, and when you have the GPU capacity to run a 7-billion-parameter model.

The trade-off is serving cost. A 7-billion-parameter embedder needs a serious GPU and careful batching, while the standard E5 models run on modest hardware. For most teams the standard models are the right answer, and the Mistral variant is worth evaluating only when the standard models demonstrably fall short on hard retrieval tasks.

How E5 fits into a retrieval system

E5 models slot into a standard retrieval pipeline: chunk documents, embed with the right prefixes, store vectors in a database, embed the query the same way, and return the nearest passages. Because the models are open and small, they also fit on-device and edge deployments where an API call is not possible. Our guide to choosing and tuning RAG embedding models walks through the selection and evaluation process in detail.

E5 pairs well with hybrid search, since its dense vectors can be combined with keyword matching for queries that contain rare terms, error codes or product names. Our guide to hybrid search for RAG explains how to combine the two signals. And because E5 vectors are standard dense vectors, they work with any vector database; our guide to vector embedding storage covers the storage costs that quietly dominate a self-hosted system.

Limitations to know before you commit

The 512-token limit on the standard models is the first constraint: long documents need chunking, and the quality of your retrieval will depend on it. Second, the prefix rule is a genuine footgun, and a pipeline that drops prefixes silently loses quality with no error message. Third, the multilingual models perform worse on low-resource languages, so test your actual languages rather than assuming coverage. Fourth, E5 is text-only, so image-heavy corpora need a multimodal model instead. Finally, self-hosting means you own serving, scaling and monitoring, which is real engineering work that a hosted API hides.

Decision checklist: should you use E5 embeddings?

  • Prefix check: confirm your pipeline adds “query: ” to queries and “passage: ” to documents, or the instruct format for the instruct models.
  • Language scope: English-only corpora suit the v2 ladder; anything multilingual points to multilingual-e5-large.
  • Size test: compare small, base and large on your own evaluation set before paying for the largest model.
  • Chunking plan: decide chunk size and overlap before embedding, since the 512-token limit makes chunking decisive.
  • Hardware: confirm you have the compute for your chosen model, and test quantized versions for serving.
  • Mistral variant: evaluate e5-mistral-7b-instruct only if the standard models fall short on hard retrieval tasks.
  • Hybrid search: test combining E5 vectors with keyword matching when queries contain rare terms or identifiers.

Frequently asked questions

What are E5 embeddings?

E5 embeddings are open-weight text embedding models from Microsoft, trained with weakly supervised contrastive learning. The family includes English, multilingual and instruction-tuned variants, all released under the MIT licence.

What prefixes do E5 embeddings need?

For the v2 and plain multilingual models, prepend “query: ” to search queries and “passage: ” to documents. The instruct variants use a one-sentence task instruction before the query instead, with no prefix on documents.

Which E5 model should I use?

Use e5-large-v2 for English retrieval quality, e5-base-v2 for a balance of speed and quality, and e5-small-v2 when latency or memory dominates. Use multilingual-e5-large for corpora spanning many languages.

What is the maximum input length for E5 embeddings?

The standard E5 models truncate input at 512 tokens. e5-mistral-7b-instruct accepts up to 4,096 tokens, which suits longer passages and harder retrieval tasks.

Are E5 embeddings free?

Yes. The weights are free under the MIT licence and you can use them commercially. Your costs are the hardware and electricity to run them, not per-token API fees.

How do E5 embeddings compare with BGE embeddings?

Both are free, open-weight families with similar sizes and quality on English retrieval. BGE’s bge-m3 offers an 8,192-token context and multi-vector output that E5 lacks, while E5’s prefix system and Mistral variant suit teams that want instruction-tuned retrieval. Test both on your own data.

Latest articles

Scroll to Top