bibtext: @inproceedings{
  behnamghader2024llmvec,
  title={{LLM}2Vec: Large Language Models Are Secretly Powerful Text Encoders},
  author={Parishad BehnamGhader and Vaibhav Adlakha and Marius Mosbach and Dzmitry Bahdanau and Nicolas Chapados and Siva Reddy},
  booktitle={First Conference on Language Modeling},
  year={2024},
  url={https://openreview.net/forum?id=IW1PR7vEBf}
  }
abstract: Large decoder-only language models (LLMs) are the state-of-the-art models on most of today's NLP tasks and benchmarks. Yet, the community is only slowly adopting these models for text embedding tasks, which require rich contextualized representations. In this work, we introduce LLM2Vec, a simple unsupervised approach that can transform any decoder-only LLM into a strong text encoder. LLM2Vec consists of three simple steps: 1) enabling bidirectional attention, 2) masked next token prediction, and 3) unsupervised contrastive learning. We demonstrate the effectiveness of LLM2Vec by applying it to 4 popular LLMs ranging from 1.3B to 8B parameters and evaluate the transformed models on English word- and sequence-level tasks. We outperform encoder-only models by a large margin on word-level tasks and reach a new unsupervised state-of-the-art performance on the Massive Text Embeddings Benchmark (MTEB). Moreover, when combining LLM2Vec with supervised contrastive learning, we achieve state-of-the-art performance on MTEB among models that train only on publicly available data (as of May 24, 2024). Our strong empirical results and extensive analysis demonstrate that LLMs can be effectively transformed into universal text encoders in a parameter-efficient manner without the need for expensive adaptation or synthetic GPT-4 generated data.
title: LLM2Vec: Large Language Models Are Secretly Powerful Text Encoders
authors: Parishad BehnamGhader Vaibhav Adlakha Marius Mosbach Dzmitry Bahdanau Nicolas Chapados Siva Reddy
Models: McGill-NLP/LLM2Vec-Meta-Llama-3-8B-Instruct-mntp-supervised McGill-NLP/LLM2Vec-Mistral-7B-Instruct-v2-mntp-supervised McGill-NLP/LLM2Vec-Meta-Llama-3-8B-Instruct-mntp McGill-NLP/LLM2Vec-Mistral-7B-Instruct-v2-mntp McGill-NLP/LLM2Vec-Mistral-7B-Instruct-v2-mntp-unsup-simcse knowledgator/Qwen-encoder-0.5B McGill-NLP/LLM2Vec-Sheared-LLaMA-mntp McGill-NLP/LLM2Vec-Sheared-LLaMA-mntp-supervised McGill-NLP/LLM2Vec-Meta-Llama-3-8B-Instruct-mntp-unsup-simcse McGill-NLP/LLM2Vec-Llama-2-7b-chat-hf-mntp-supervised McGill-NLP/LLM2Vec-Sheared-LLaMA-mntp-unsup-simcse knowledgator/Sheared-LLaMA-encoder-1.3B knowledgator/Qwen-encoder-1.5B macadeliccc/dolphin-2.9-llama3-8b-emb McGill-NLP/LLM2Vec-Llama-2-7b-chat-hf-mntp McGill-NLP/LLM2Vec-Llama-2-7b-chat-hf-mntp-unsup-simcse knowledgator/Llama-encoder-1.0B uzabase/LLM2Vec-Llama-2-7b-hf-mntp uzabase/LLM2Vec-Llama-2-7b-hf-wikipedia-jp-mntp uzabase/LLM2Vec-Swallow-7b-hf-wikipedia-jp-mntp uzabase/LLM2Vec-Llama-2-7b-hf-mntp-unsup-simcse uzabase/LLM2Vec-Llama-2-7b-hf-wikipedia-jp-mntp-unsup-simcse uzabase/LLM2Vec-Swallow-7b-hf-wikipedia-jp-mntp-unsup-simcse RichardErkhov/knowledgator_-_Llama-encoder-1.0B-gguf RichardErkhov/knowledgator_-_Qwen-encoder-0.5B-gguf RichardErkhov/knowledgator_-_Qwen-encoder-1.5B-gguf