Llama2Vec: Unsupervised Adaptation of Large Language Models for Dense Retrieval
作者: Zheng Liu, Chaofan Li, Shitao Xiao, Yingxia Shao, Defu Lian
分类: cs.CL
发布日期: 2023-12-24 (更新: 2025-11-23)
备注: ACL 2024
🔗 代码/项目: GITHUB
💡 一句话要点
提出Llama2Vec以解决大规模语言模型在密集检索中的适应问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 密集检索 大规模语言模型 无监督学习 文本嵌入 信息检索 模型适应
📋 核心要点
- 现有的LLMs通过自回归学习,无法直接用于密集检索中的全文本嵌入表示,导致适应性不足。
- Llama2Vec通过无监督的方式,利用EBAE和EBAR任务,使LLM能够有效重构输入和预测文本,适应密集检索需求。
- 实验结果表明,Llama2Vec在多个密集检索基准上显著提升了性能,尤其在MSMARCO和BEIR上达到了新的最优状态。
📝 摘要(中文)
密集检索需要具有区分性的嵌入来表示查询与文档之间的语义关系。鉴于大规模语言模型(LLMs)在语义理解方面的强大能力,如何有效适应LLMs以作为密集检索的骨干编码器显得尤为重要。本文提出了一种新方法Llama2Vec,通过无监督适应LLMs用于密集检索。Llama2Vec包含两个预训练任务:嵌入基础自编码(EBAE)和嵌入基础自回归(EBAR),使LLM能够重构输入句子并基于文本嵌入预测下一个句子。该方法简单、轻量且高效,经过适度的适应后,显著提升了模型在多种密集检索基准上的微调性能,并在MSMARCO的段落和文档检索以及BEIR的零-shot检索上取得了新的最优表现。
🔬 方法详解
问题定义:本文旨在解决大规模语言模型(LLMs)在密集检索中的适应性问题。现有方法主要依赖自回归学习,无法有效生成用于检索的全文本嵌入,导致性能不足。
核心思路:Llama2Vec通过无监督适应策略,设计了两个预训练任务(EBAE和EBAR),使LLM能够在不依赖标注数据的情况下,学习如何生成有效的文本嵌入,进而适应密集检索的需求。
技术框架:Llama2Vec的整体架构包括两个主要模块:EBAE负责重构输入句子,而EBAR则用于预测下一个句子。通过这两个任务,模型能够学习到更具区分性的嵌入表示。
关键创新:Llama2Vec的创新之处在于其无监督适应策略,通过简单的预训练任务有效提升了LLMs在密集检索中的表现,区别于传统的有监督学习方法。
关键设计:在模型设计上,Llama2Vec采用了轻量级的架构,损失函数设计上结合了重构损失和预测损失,以确保模型在嵌入生成上的有效性和准确性。
📊 实验亮点
在实验中,Llama2Vec显著提升了模型在MSMARCO基准上的段落和文档检索性能,并在BEIR基准上实现了零-shot检索的新状态,展示了其在密集检索任务中的优越性和有效性。
🎯 应用场景
Llama2Vec的研究成果在信息检索、问答系统和推荐系统等领域具有广泛的应用潜力。通过提升大规模语言模型在密集检索中的表现,可以显著改善用户的搜索体验和信息获取效率,推动相关技术的发展与应用。
📄 摘要(原文)
Dense retrieval calls for discriminative embeddings to represent the semantic relationship between query and document. It may benefit from the using of large language models (LLMs), given LLMs' strong capability on semantic understanding. However, the LLMs are learned by auto-regression, whose working mechanism is completely different from representing whole text as one discriminative embedding. Thus, it is imperative to study how to adapt LLMs properly so that they can be effectively initialized as the backbone encoder for dense retrieval. In this paper, we propose a novel approach, called Llama2Vec, which performs unsupervised adaptation of LLM for its dense retrieval application. Llama2Vec consists of two pretext tasks: EBAE (Embedding-Based Auto-Encoding) and EBAR (Embedding-Based Auto-Regression), where the LLM is prompted to reconstruct the input sentence and predict the next sentence based on its text embeddings. Llama2Vec is simple, lightweight, but highly effective. It is used to adapt LLaMA-2-7B on the Wikipedia corpus. With a moderate steps of adaptation, it substantially improves the model's fine-tuned performances on a variety of dense retrieval benchmarks. Notably, it results in the new state-of-the-art performances on popular benchmarks, such as passage and document retrieval on MSMARCO, and zero-shot retrieval on BEIR. The model and source code will be made publicly available to facilitate the future research. Our model is available at https://github.com/FlagOpen/FlagEmbedding.