对比RAG与长文本模型在知识增强中的表现,发现无绝对优劣。
LaRA: Benchmarking Retrieval-Augmented Generation and Long-Context LLMs -- No Silver Bullet for LC or RAG Routing
- 构建新基准LaRA,涵盖2326个测试用例,覆盖四类问答任务。
- 7个开源和4个闭源模型实测显示,性能取决于模型大小、任务类型等多因素。
- 为开发者提供选择RAG或长文本模型的实用指南,适合实际应用部署者。
将外部知识有效融入大语言模型(LLM)对于提升其能力并满足真实需求至关重要。检索增强生成(RAG)通过检索最相关片段来增强模型,是一种有效方法。然而,随着大语言模型上下文窗口的扩展,长文本(LC)模型提供了另一种途径,引发疑问:在处理外部知识时,RAG是否仍有必要?现有研究对RAG与长文本模型的比较结果不一,主要因基准设计局限。本文提出LaRA,一个专门设计用于严格对比RAG与长文本模型的新基准。该基准包含2326个测试用例,覆盖四类实际问答任务及三类自然出现的长文本。通过对7个开源和4个闭源模型的系统评估,我们发现最优选择取决于模型参数量、长文本能力、上下文长度、任务类型以及检索片段特征的复杂交互。研究结果为实践者在开发与部署大语言模型应用时,有效利用RAG与长文本方法提供了可操作的指导。代码与数据集已公开于:https://github.com/Alibaba-NLP/LaRA。
原文摘要 · Abstract (English)
Effectively incorporating external knowledge into Large Language Models (LLMs) is crucial for enhancing their capabilities and addressing real-world needs. Retrieval-Augmented Generation (RAG) offers an effective method for achieving this by retrieving the most relevant fragments into LLMs. However, the advancements in context window size for LLMs offer an alternative approach, raising the question of whether RAG remains necessary for effectively handling external knowledge. Several existing studies provide inconclusive comparisons between RAG and long-context (LC) LLMs, largely due to limitations in the benchmark designs. In this paper, we present LaRA, a novel benchmark specifically designed to rigorously compare RAG and LC LLMs. LaRA encompasses 2326 test cases across four practical QA task categories and three types of naturally occurring long texts. Through systematic evaluation of seven open-source and four proprietary LLMs, we find that the optimal choice between RAG and LC depends on a complex interplay of factors, including the model's parameter size, long-text capabilities, context length, task type, and the characteristics of the retrieved chunks. Our findings provide actionable guidelines for practitioners to effectively leverage both RAG and LC approaches in developing and deploying LLM applications. Our code and dataset is provided at: \href{https://github.com/Alibaba-NLP/LaRA}{\textbf{https://github.com/Alibaba-NLP/LaRA}}.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。