让大模型同时具备文本生成与高质量嵌入能力,无需额外模型。
GEM: Empowering LLM for both Embedding Generation and Language Understanding
- 通过插入特殊标记并调整注意力掩码,让大模型自动生成文本嵌入。
- 在MTEB上显著提升嵌入性能,对MMLU任务影响极小。
- 适配1B到8B参数模型,可无缝集成到现有训练流程中。
大型解码器型语言模型(LLM)在生成和推理任务中表现卓越,但许多应用如检索增强生成(RAG)仍需独立的嵌入模型生成文本向量,导致系统复杂且理解不一致。为此,我们提出一种简单的自监督方法——生成式嵌入大模型(GEM),使任意大型解码器型LLM在保持原有文本生成与推理能力的同时,具备高质量文本嵌入生成能力。该方法在文本中插入特殊标记,并通过操控注意力掩码生成摘要式嵌入。该方法可轻松集成至任何现有LLM的后训练或微调阶段。我们在两个主流LLM家族(1B至8B参数)上验证该方法,分别在文本嵌入基准(MTEB)和NLP基准(MMLU)上进行评估。结果表明,改进后的模型在MTEB上显著优于原模型,而在MMLU上性能几乎无损。结果表明,GEM可赋予大模型顶尖的文本嵌入能力,同时维持其原有的自然语言处理性能。
原文摘要 · Abstract (English)
Large decoder-only language models (LLMs) have achieved remarkable success in generation and reasoning tasks, where they generate text responses given instructions. However, many applications, e.g., retrieval augmented generation (RAG), still rely on separate embedding models to generate text embeddings, which can complicate the system and introduce discrepancies in understanding of the query between the embedding model and LLMs. To address this limitation, we propose a simple self-supervised approach, Generative Embedding large language Model (GEM), that enables any large decoder-only LLM to generate high-quality text embeddings while maintaining its original text generation and reasoning capabilities. Our method inserts new special token(s) into a text body, and generates summarization embedding of the text by manipulating the attention mask. This method could be easily integrated into post-training or fine tuning stages of any existing LLMs. We demonstrate the effectiveness of our approach by applying it to two popular LLM families, ranging from 1B to 8B parameters, and evaluating the transformed models on both text embedding benchmarks (MTEB) and NLP benchmarks (MMLU). The results show that our proposed method significantly improves the original LLMs on MTEB while having a minimal impact on MMLU. Our strong results indicate that our approach can empower LLMs with state-of-the-art text embedding capabilities while maintaining their original NLP performance
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。