Skip to main content
QUICK REVIEW

[Paper Review] Improving Text Embeddings with Large Language Models

Liang Wang, Nan Yang|arXiv (Cornell University)|Dec 31, 2023
Topic ModelingComputer Science13 citations
TL;DR

The authors generate diverse synthetic data with proprietary LLMs to train open-source decoder-only models for text embeddings, achieving strong results with under 1k training steps and no labeled data, and state-of-the-art on BEIR and MTEB when using synthetic plus some labeled data.

ABSTRACT

In this paper, we introduce a novel and simple method for obtaining high-quality text embeddings using only synthetic data and less than 1k training steps. Unlike existing methods that often depend on multi-stage intermediate pre-training with billions of weakly-supervised text pairs, followed by fine-tuning with a few labeled datasets, our method does not require building complex training pipelines or relying on manually collected datasets that are often constrained by task diversity and language coverage. We leverage proprietary LLMs to generate diverse synthetic data for hundreds of thousands of text embedding tasks across 93 languages. We then fine-tune open-source decoder-only LLMs on the synthetic data using standard contrastive loss. Experiments demonstrate that our method achieves strong performance on highly competitive text embedding benchmarks without using any labeled data. Furthermore, when fine-tuned with a mixture of synthetic and labeled data, our model sets new state-of-the-art results on the BEIR and MTEB benchmarks.

Motivation & Objective

  • Motivate improving text embeddings without multi-stage pipelines or large labeled datasets.
  • Propose a simple synthetic-data generation pipeline using LLMs across many languages and tasks.
  • Demonstrate that fine-tuning open-source LLMs on synthetic data yields competitive embeddings.
  • Show state-of-the-art results on BEIR and MTEB when combined with labeled data.
  • Discuss multilinguality and long-context capabilities of the approach.

Proposed method

  • Use proprietary LLMs to brainstorm and generate task-specific synthetic (query, positive, hard negative) triplets across 93 languages.
  • Apply a two-step prompting strategy: brainstorm task pool, then generate data conditioned on task definitions.
  • Fine-tune open-source decoder-only LLMs (Mistral-7B) with InfoNCE contrastive loss on synthetic data (and MS MARCO when available).
  • Use last-token embedding from pretrained LLMs as query/document representations, with temperature tau=0.02 in cosine similarity.
  • Adopt LoRA with rank 16 and training tricks (gradient checkpointing, mixed precision, DeepSpeed ZeRO-3) to enable <1k steps.
  • Explore long-context capabilities via RoPE rotation base adjustments and synthetic long-context tasks.
Figure 1: An example two-step prompt template for generating synthetic data with GPT-4. We first prompt GPT-4 to brainstorm a list of potential retrieval tasks, and then generate (query, positive, hard negative) triplets for each task. “ { … } ” denotes a placeholder that will be replaced by samplin
Figure 1: An example two-step prompt template for generating synthetic data with GPT-4. We first prompt GPT-4 to brainstorm a list of potential retrieval tasks, and then generate (query, positive, hard negative) triplets for each task. “ { … } ” denotes a placeholder that will be replaced by samplin

Experimental results

Research questions

  • RQ1Can high-quality text embeddings be learned with single-stage training using synthetic data generated by LLMs?
  • RQ2What is the impact of synthetic data alone versus synthetic plus labeled data on benchmark performance (BEIR, MTEB)?
  • RQ3How does multilingual coverage affect embedding quality across high- and low-resource languages?
  • RQ4Is contrastive pre-training necessary for highly pre-trained LLMs to yield good embeddings?
  • RQ5Can embeddings be extended to long-context tasks and personalized retrieval scenarios?

Key findings

  • Training with synthetic data alone yields competitive MTEB performance without any labeled data.
  • Fine-tuning with a mix of synthetic and labeled data achieves state-of-the-art results on BEIR and MTEB benchmarks.
  • The model with synthetic data only reaches an average MTEB score of 63.1, while synthetic plus MS-MARCO reaches 64.5, and full data reaches 66.6.
  • E5_mistral-7b with full data outperforms prior state-of-the-art by 2.4 points on MTEB average.
  • Contrastive pre-training is less impactful for Mistral-7B-based models than for other architectures, suggesting auto-regressive pre-training provides strong representations.
  • The approach scales to 93 languages and demonstrates long-context capabilities via context-length extensions, with best results in high-resource languages.
Figure 2: Task type and language statistics of the generated synthetic data (see Section 3.1 for task type definitions). The “Others” category contains the remaining languages from the XLM-R language list.
Figure 2: Task type and language statistics of the generated synthetic data (see Section 3.1 for task type definitions). The “Others” category contains the remaining languages from the XLM-R language list.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.