Retrieval-augmented generation (RAG) is a promising way to improve large language models (LLMs) for generating more factual, accurate, and up-to-date content. Existing methods either optimize prompts to guide LLMs in leveraging retrieved information or directly fine-tune the LLMs to adapt to RAG scenarios. Although fine-tuning can yield better performance, it often compromises the LLMs' general generation capabilities by modifying their parameters. This limitation poses challenges in practical applications, especially when LLMs are already deployed, as parameter adjustments may affect their original functionality. To address this, we propose a novel method that involves learning scalable and pluggable virtual tokens for RAG. By maintaining the LLMs' original parameters and fine-tuning only the embeddings of these pluggable tokens, our approach not only enhances LLMs' performance but also preserves their general generation capacities. Furthermore, we design several training strategies to improve the scalability, flexibility, and generalizability of our method. Comprehensive experiments across nine question-answering tasks demonstrate the superiority of our approach.
翻译:检索增强生成是一种通过增强大语言模型生成内容的真实性、准确性和时效性的有效途径。现有方法或通过优化提示词来引导大语言模型利用检索信息,或直接对大语言模型进行微调以适配检索增强场景。尽管微调能带来更好的性能,但其通常通过修改模型参数而损害大语言模型的通用生成能力。这一局限在实际应用中,尤其当大语言模型已部署时,带来了挑战,因为参数调整可能影响其原有功能。为解决此问题,我们提出了一种新颖的方法,通过学习可扩展、可插拔的虚拟词元来实现检索增强。通过保持大语言模型原始参数不变,仅微调这些可插拔词元的嵌入向量,我们的方法不仅提升了大语言模型的性能,同时保留了其通用生成能力。此外,我们设计了多种训练策略以提升方法的可扩展性、灵活性和泛化能力。在九个问答任务上的综合实验验证了我们方法的优越性。