Making Text Embedders Few-Shot Learners

Chaofan Li, MingHao Qin, Shitao Xiao, Jianlyu Chen, Kun Luo +3 more
9/24/2024
cs.IRcs.CL

Official code: FlagOpen/FlagEmbedding (11,860 stars, MIT, last commit 2026-04-22).

Abstract

Large language models (LLMs) with decoder-only architectures demonstrate remarkable in-context learning (ICL) capabilities. This feature enables them to effectively handle both familiar and novel tasks by utilizing examples provided within their input context. Recognizing the potential of this capability, we propose leveraging the ICL feature in LLMs to enhance the process of text embedding generation. To this end, we introduce a novel model bge-en-icl, which employs few-shot examples to produce high-quality text embeddings. Our approach integrates task-related examples directly into the query side, resulting in significant improvements across various tasks. Additionally, we have investigated how to effectively utilize LLMs as embedding models, including various attention mechanisms, pooling methods, etc. Our findings suggest that retaining the original framework often yields the best results, underscoring that simplicity is best. Experimental results on the MTEB and AIR-Bench benchmarks demonstrate that our approach sets new state-of-the-art (SOTA) performance. Our model, code and dataset are freely available at https://github.com/FlagOpen/FlagEmbedding .

View on arXivView PDF

Code Implementations(1)

MIT

Retrieval and Retrieval-augmented LLMs

11,860891Shell, PythonAug 2, 20236 months agoMIT
embeddingsinformation-retrievalllmretrieval-augmented-generationsentence-embeddings+1 more

Similar Papers

Cite this paper

@article{li2024making,
  title  = {Making Text Embedders Few-Shot Learners},
  author = {Chaofan Li and MingHao Qin and Shitao Xiao and Jianlyu Chen and Kun Luo and Yingxia Shao and Defu Lian and Zheng Liu},
  year   = {2024},
  eprint = {2409.15700},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2409.15700v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2409.15700.svg)](https://codeofpaper.com/paper/2409.15700)

Discussion