arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.17428cs.CLcs.AIcs.IRcs.LG
收藏

NV-Embed:改进训练LLM作为通用嵌入模型的技术

NV-Embed: Improved Techniques for Training LLMs as Generalist Embedding Models

NVIDIA(英伟达)

Chankyu Lee, Rajarshi Roy, Mengyao Xu, Jonathan Raiman, Mohammad Shoeybi, Bryan Catanzaro, Wei Ping

AI总结:

NV-Embed通过潜在注意力层、去除因果掩码和两阶段对比指令微调等技术,显著提升LLM作为通用嵌入模型的性能,在MTEB和AIR基准上取得领先成绩。

摘要:

基于仅解码器LLM的嵌入模型在通用文本嵌入任务(包括基于稠密向量的检索)中开始超越基于BERT或T5的嵌入模型。在本工作中,我们介绍了NV-Embed,它结合了架构设计、训练流程和精选数据集,显著提升了LLM作为多功能嵌入模型的性能,同时保持了其简单性和可复现性。在模型架构方面,我们提出了一种潜在注意力层来获取池化嵌入,与均值池化或使用LLM的最后一个<EOS>标记嵌入相比,它持续提高了检索和下游任务的准确性。为了增强表示学习,我们在对比训练期间移除了LLM的因果注意力掩码。在训练算法方面,我们引入了一种两阶段对比指令微调方法。第一阶段首先在检索数据集上应用带指令的对比训练,利用批内负样本和精选的困难负样本。在第二阶段,它将各种非检索任务混合到指令微调中,这不仅提高了非检索任务的准确性,还改善了检索性能。在训练数据方面,我们利用困难负样本挖掘、合成数据生成和现有的公开数据集来提升嵌入模型的性能。通过结合这些技术,我们的NV-Embed-v1和NV-Embed-v2模型分别在2024年5月24日和8月30日,在MTEB排行榜的56个任务上获得了第一名,证明了所提出方法的长期有效性。它还在AIR基准测试的Long Doc部分取得了最高分,在QA部分取得了第二高分,该基准涵盖了MTEB之外的一系列域外信息检索主题。我们进一步提供了针对通用嵌入模型的模型压缩技术分析。

英文摘要:

Decoder-only LLM-based embedding models are beginning to outperform BERT or T5-based embedding models in general-purpose text embedding tasks, including dense vector-based retrieval. In this work, we introduce NV-Embed, incorporating architectural designs, training procedures, and curated datasets to significantly enhance the performance of LLM as a versatile embedding model, while maintaining its simplicity and reproducibility. For model architecture, we propose a latent attention layer to obtain pooled embeddings, which consistently improves retrieval and downstream task accuracy compared to mean pooling or using the last <EOS> token embedding from LLMs. To enhance representation learning, we remove the causal attention mask of LLMs during contrastive training. For training algorithm, we introduce a two-stage contrastive instruction-tuning method. It first applies contrastive training with instructions on retrieval datasets, utilizing in-batch negatives and curated hard negative examples. At stage-2, it blends various non-retrieval into instruction tuning, which not only enhances non-retrieval task accuracy but also improves retrieval performance. For training data, we utilize the hard-negative mining, synthetic data generation and existing public available datasets to boost the performance of embedding model. By combining these techniques, our NV-Embed-v1 and NV-Embed-v2 models obtained the No.1 position on the MTEB leaderboard (as of May 24 and August 30, 2024, respectively) across 56 tasks, demonstrating the sustained effectiveness of the proposed methods over time. It also achieved the highest scores in the Long Doc section and the second-highest scores in the QA section of the AIR Benchmark, which covers a range of out-of-domain information retrieval topics beyond those in MTEB. We further provide the analysis of model compression techniques for generalist embedding models.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑