Skip to main content
QUICK REVIEW

[论文解读] In Defense of RAG in the Era of Long-Context Language Models

Yu Tan, Anbang Xu|arXiv (Cornell University)|Sep 3, 2024
Topic Modeling被引用 4
一句话总结

本文提出顺序保持检索增强生成(OP-RAG),通过保持检索到的文档块原始顺序,提升长上下文问答任务中的答案质量。与原始RAG或长上下文大模型相比,OP-RAG在仅使用48K个输入标记的情况下,F1分数达到最高47.25,显著低于长上下文模型处理117K–196K个标记的规模,表明聚焦检索优于单纯扩展上下文长度。

ABSTRACT

Overcoming the limited context limitations in early-generation LLMs, retrieval-augmented generation (RAG) has been a reliable solution for context-based answer generation in the past. Recently, the emergence of long-context LLMs allows the models to incorporate much longer text sequences, making RAG less attractive. Recent studies show that long-context LLMs significantly outperform RAG in long-context applications. Unlike the existing works favoring the long-context LLM over RAG, we argue that the extremely long context in LLMs suffers from a diminished focus on relevant information and leads to potential degradation in answer quality. This paper revisits the RAG in long-context answer generation. We propose an order-preserve retrieval-augmented generation (OP-RAG) mechanism, which significantly improves the performance of RAG for long-context question-answer applications. With OP-RAG, as the number of retrieved chunks increases, the answer quality initially rises, and then declines, forming an inverted U-shaped curve. There exist sweet points where OP-RAG could achieve higher answer quality with much less tokens than long-context LLM taking the whole context as input. Extensive experiments on public benchmark demonstrate the superiority of our OP-RAG.

研究动机与目标

  • 重新评估长上下文大模型时代RAG的作用,挑战‘仅靠长上下文模型优于检索增强方法’的假设。
  • 探究在长上下文问答任务中,检索块的顺序是否影响答案质量。
  • 识别RAG性能达到峰值后因引入无关信息而开始下降的最优检索范围。
  • 证明高效、聚焦的检索可超越处理整篇文档的长上下文大模型的性能。

提出的方法

  • 提出顺序保持RAG(OP-RAG),保留检索到的文档块原始顺序,而非按相关性重新排序。
  • 使用密集向量检索(BGE-large-en-v1.5)对查询和文档块进行嵌入,基于相似度检索top-k个块。
  • 通过按原始文档顺序拼接检索到的块,构建LLM的输入上下文,保持时间与结构连贯性。
  • 系统性地改变检索块的数量,研究召回率(更多相关信息)与精确率(更少干扰)之间的权衡。
  • 使用Llama3.1-70B及其他长上下文大模型作为生成器,评估不同输入长度下的性能表现。
  • 实施消融研究,以分离检索顺序与上下文长度对答案质量的影响。
(a) F1 score.
(a) F1 score.

实验结果

研究问题

  • RQ1与按相关性排序的检索相比,保持检索块原始顺序是否能提升长上下文问答任务中的答案质量?
  • RQ2随着检索块数量的增加,RAG的答案质量如何变化?其变化是否呈现倒U型曲线?
  • RQ3在优化块数量的前提下,RAG是否能超越处理整篇文档的长上下文大模型,尽管使用更少的标记?
  • RQ4在长上下文RAG系统中,检索召回率与干扰之间的最优平衡点是什么?
  • RQ5模型规模(如Llama3.1-8B与70B)如何影响OP-RAG中性能峰值点的位置?

主要发现

  • OP-RAG在En.QA基准上仅使用48K个输入标记,F1分数达到47.25,优于未使用RAG的Llama3.1-70B(使用117K标记,F1为34.26)。
  • 在检索128个块时,OP-RAG在En.QA上的F1分数为44.43,而相同块数的原始RAG仅达38.40。
  • 在EN.MC数据集上,OP-RAG使用192个块时准确率达88.65%,而原始RAG为81.22%,表明在大规模下性能显著提升。
  • OP-RAG的性能呈现倒U型曲线:随着块数增加,质量先提升至峰值,随后因无关内容增多而下降。
  • OP-RAG使用24K标记在EN.MC数据集上达到88.65%准确率,超越GPT-4O(78.42%)和Gemini-1.5-Pro(85.57%),尽管使用的标记数远少于它们。
  • Llama3.1-70B在En.QA上的性能峰值出现在48K标记处,在EN.MC上则为32K标记,表明大模型在性能下降前可容忍更多上下文。
(b) Input token count.
(b) Input token count.

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。