Conference Paper
Machine Learning

E5 Mistral-7B

Liang Wang, Nan Yang, Xiaolong Huang, Linjun Yang, Rangan Majumder, Furu Wei
December 1, 2023Annual Meeting of the Association for Computational Linguistics402 citations

402

Citations

28

Influential Citations

Annual Meeting of the Association for Computational Linguistics

Venue

2023

Year

Abstract

Leverages proprietary LLMs to generate diverse synthetic data to fine tune open-source decoder-only LLMs for hundreds of thousands of text embedding tasks.

Analysis

Why This Paper Matters

Text embeddings are the backbone of many NLP applications, from search to retrieval-augmented generation. Traditionally, building high-quality embedding models requires massive labeled datasets, which are expensive and language-specific. E5-Mistral-7B flips this paradigm by showing that synthetic data generated by proprietary LLMs can replace human-labeled data entirely, achieving state-of-the-art results with minimal training. This is a game-changer for practitioners who need multilingual, task-agnostic embeddings without the overhead of data collection.

How It Works

The paper introduces a straightforward pipeline: generate diverse synthetic data using GPT-4 and GPT-3.5, then fine-tune Mistral-7B with contrastive loss. The key innovation lies in the data generation strategy.

Figure 1

Embedding tasks are split into asymmetric (query and document are semantically related but not paraphrases) and symmetric (query and document are paraphrases). For asymmetric tasks, a two-step prompt template first brainstorms a list of tasks, then generates a concrete example. For symmetric tasks, the brainstorming step is omitted since the task is straightforward. Placeholders are inserted into prompts to increase diversity.

An example two-step prompt template for generating synthetic data with GPT-4.

In total, 500k examples with 150k unique instructions were generated, 25% from GPT-3.5 and the rest from GPT-4. The data covers 93 languages, with English dominating but low-resource languages having about 1k examples each.

Task type and language statistics of the generated synthetic data.

For training, the query is prepended with an instruction template while the document remains unchanged. This allows pre-building the document index and customizing tasks by changing only the query side. The [EOS] token is appended to both query and document, and the last-layer [EOS] vector is used as the embedding. Standard InfoNCE loss with temperature-scaled cosine similarity is applied over in-batch negatives and hard negatives.

Figure 4

Instructions for each training dataset.

Figure 6

Figure 7

The model is fine-tuned for one epoch on a mix of synthetic data and 13 public datasets (e.g., ELI5, HotpotQA, MS MARCO), totaling about 1.8M examples.

Results

On the MTEB benchmark, E5-Mistral-7B with full data outperforms the previous state-of-the-art by 2.4 points. Even when using only synthetic data (no labeled data), performance remains competitive.

Results on the MTEB benchmark

Compared to commercial models, it achieves a significant margin, though fair comparison is hindered by lack of transparency.

Comparison with commercial models and the model that tops the MTEB leaderboard.

On the MIRACL multilingual dataset covering 18 languages, the model excels in high-resource languages (especially English) but lags behind mE5-base in low-resource languages, likely due to Mistral-7B's English-centric pretraining.

Figure 10

An ablation study shows that contrastive pre-training has negligible impact on Mistral-7B-based models, unlike XLM-R-large. This suggests that extensive autoregressive pretraining already provides strong text representations, and minimal fine-tuning suffices.

Effects of contrastive pre-training.

Significance

E5-Mistral-7B demonstrates that synthetic data from proprietary LLMs can effectively train open-source embedding models, reducing reliance on expensive labeled datasets. This opens the door for scalable, multilingual embedding systems that can be adapted to new tasks with minimal effort. The finding that autoregressive pretraining reduces the need for contrastive pre-training is also valuable for practitioners, suggesting that large decoder-only LLMs are already strong embedding backbones. However, the English-centric bias of Mistral-7B limits performance in low-resource languages, highlighting the need for more balanced multilingual pretraining or targeted data augmentation.