Skip to main content
QUICK REVIEW

[论文解读] Long Context RAG Performance of Large Language Models

Quinn Leng, Jacob Portes|arXiv (Cornell University)|Nov 5, 2024
Topic ModelingComputer Science被引用 5
一句话总结

该论文系统性评估在三个数据集上,增加上下文长度如何影响 Retrieval-Augmented Generation (RAG) 的性能,对 20 个 LLMs,发现较长的上下文对一些最新的模型有帮助,但对大多数开源模型帮助不大,并观察到了多样的失败模式。

ABSTRACT

Retrieval Augmented Generation (RAG) has emerged as a crucial technique for enhancing the accuracy of Large Language Models (LLMs) by incorporating external information. With the advent of LLMs that support increasingly longer context lengths, there is a growing interest in understanding how these models perform in RAG scenarios. Can these new long context models improve RAG performance? This paper presents a comprehensive study of the impact of increased context length on RAG performance across 20 popular open source and commercial LLMs. We ran RAG workflows while varying the total context length from 2,000 to 128,000 tokens (and 2 million tokens when possible) on three domain-specific datasets, and report key insights on the benefits and limitations of long context in RAG applications. Our findings reveal that while retrieving more documents can improve performance, only a handful of the most recent state of the art LLMs can maintain consistent accuracy at long context above 64k tokens. We also identify distinct failure modes in long context scenarios, suggesting areas for future research.

研究动机与目标

  • 评估在广泛的 LLM 集合中,较长的上下文长度是否会提升 RAG 性能。
  • 量化随着上下文从 2,000 到 128,000 标记(某些模型可达 2,000,000 标记)时性能的变化。
  • 在多个领域中识别模型特定的失败模式及长上下文 RAG 情景中的局限性。

提出的方法

  • 对 20 个开源和商业 LLM 进行基准测试,上下文长度从 2k 到 128k 标记(可在可能的情况下达到 2M 标记)。
  • 使用带固定嵌入模型和 FAISS 向量存储的标准 RAG 流程来检索文档片段。
  • 使用经过校准的 LLM 作为评审(GPT-4o)对生成答案与真实答案进行评估。
  • 通过对模型输出的定性分类分析 recall@k 的检索性能及其失败模式。
Figure 1 : Long context RAG performance of o1, GPT-4, Claude 3/3.5, Gemini 1.5 ( gemini-1.5-pro-001 and gemini-1.5-flash-001 ), Llama 3/3.1, Qwen 2, Mistral and DBRX models on 3 curated RAG datasets (Databricks DocsQA, FinanceBench, and Natural Questions). All values can be found in Table S3 . Model
Figure 1 : Long context RAG performance of o1, GPT-4, Claude 3/3.5, Gemini 1.5 ( gemini-1.5-pro-001 and gemini-1.5-flash-001 ), Llama 3/3.1, Qwen 2, Mistral and DBRX models on 3 curated RAG datasets (Databricks DocsQA, FinanceBench, and Natural Questions). All values can be found in Table S3 . Model

实验结果

研究问题

  • RQ1长上下文的 LLM 是否能在多种模型和数据集上持续提升 RAG 性能?
  • RQ2对于最先进模型与开源模型,上下文长度的变化如何影响性能的比例尺?
  • RQ3在不同模型和上下文下,长上下文 RAG 主要的失败模式是什么?
  • RQ4是否存在一个实际可行的上下文长度阈值,超过该阈值后增加检索文档数量会产生边际效益递减?

主要发现

  • 较长上下文在最近的 state-of-the-art 模型上提升 RAG 性能(例如 o1、GPT-4o、Claude 3.5、Gemini 1.5、Qwen 2 70B),但并非对所有模型都一致有效。
  • 大多数开源模型的性能提升仅持续到大约 16k–32k 标记,随后在更长的上下文中恶化。
  • Gemini 1.5 Pro/Flash 在某些任务上在极长上下文(高达 2,000,000 标记)仍保持一致性表现,与许多同类相比更为稳健。
  • 常见的失败模式包括因版权、安全过滤器和遵循指令失败而拒绝回答,且具有模型特定的模式。
  • 检索召回在较高的上下文长度下可能达到饱和(例如 DocsQA 和 FinanceBench 的 96k–128k 标记),即使生成性能并非单调增加。
  • 在理论上,直接将非常大的语料库输入某些 LLM 的长上下文长度是可行的,但成本仍是主要考量。
Figure 2 : Long context RAG performance on FinanceBench
Figure 2 : Long context RAG performance on FinanceBench

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。