[论文解读] LongRAG: Enhancing Retrieval-Augmented Generation with Long-context LLMs
LongRAG 将长上下文检索与阅读引入到 RAG,使用 4K-token 单元在不进行训练的情况下提升召回率与端到端问答性能。
In traditional RAG framework, the basic retrieval units are normally short. The common retrievers like DPR normally work with 100-word Wikipedia paragraphs. Such a design forces the retriever to search over a large corpus to find the `needle' unit. In contrast, the readers only need to generate answers from the short retrieved units. The imbalanced `heavy' retriever and `light' reader design can lead to sub-optimal performance. The loss of contextual information in the short, chunked units may increase the likelihood of introducing hard negatives during the retrieval stage. Additionally, the reader might not fully leverage the capabilities of recent advancements in LLMs. In order to alleviate the imbalance, we propose a new framework LongRAG, consisting of a `long retriever' and a `long reader'. In the two Wikipedia-based datasets, NQ and HotpotQA, LongRAG processes the entire Wikipedia corpus into 4K-token units by grouping related documents. By increasing the unit size, we significantly reduce the total number of units. This greatly reduces the burden on the retriever, resulting in strong retrieval performance with only a few (less than 8) top units. Without requiring any training, LongRAG achieves an EM of 62.7% on NQ and 64.3% on HotpotQA, which are on par with the (fully-trained) SoTA model. Furthermore, we test on two non-Wikipedia-based datasets, Qasper and MultiFieldQA-en. LongRAG processes each individual document as a single (long) unit rather than chunking them into smaller units. By doing so, we achieve an F1 score of 25.9% on Qasper and 57.5% on MultiFieldQA-en. Our study offers insights into the future roadmap for combining RAG with long-context LLMs.
研究动机与目标
- 通过使用更长的检索单元来缓解传统 RAG 中检索器与阅读器之间的不平衡。
- 提出一个 LongRAG 框架,包含一个长检索器和一个长阅读器,以利用长上下文的大型语言模型。
- 在开放域问答中在保持答案质量的同时,缩小语料库规模并提高检索召回率。
提出的方法
- 通过将相关的维基百科文档分组为 4K-token 单元来形成长检索单元。
- 使用一个长检索器检索前 4–8 个长单元,其相似度 sim(q,g) ≈ max_{g'⊆g} E_Q(q)^T E_C(g').
- 将前 k 个单元聚合为供阅读器使用的长上下文检索结果。
- 提示一个长上下文的LLM(例如 Gemini-1.5-Pro 或 GPT-4o)从拼接的检索结果中提取答案,无需任务特定训练。
- 采用两步式长阅读器方法:生成一个较长的答案,然后从中提取一个简洁的最终答案。
- 用检索单元内的分块最大值来近似长上下文嵌入评分,以避免对整个长单元进行编码。
实验结果
研究问题
- RQ1通过提高检索单元的长度,能否在保持语义完整性的同时减少需要搜索的单元数量,从而提升开放领域问答?
- RQ2在不进行微调的情况下,长上下文阅读器(如 Gemini-1.5-Pro 或 GPT-4o)在对拼接的长上下文进行零-shot 提取时的表现如何?
- RQ3检索粒度对最终问答性能的影响,以及检索的最佳单元数量是多少?
- RQ4通过长单元减少语料库规模是否以召回率换取最终任务性能的下降,与传统短单元的 RAG 相比如何?
主要发现
- 随着长检索单元的使用,召回率和端到端问答性能提升;NQ 的 recall@1 从 52%(短单元)上升到 71.69%(分组文档)。
- HotpotQA 的召回结果同样随长单元而提升,取决于单元粒度,达到 72.49–86.30 的 AR 区间。
- LongRAG 在 NQ 上的 EM 为 62.7,在 HotpotQA(full-wiki)上为 64.3,且无需任何训练,与强大的全监督基线相当。
- 使用 4–8 个长检索单元就足以获得强结果,语料库规模最多可减少 30 倍(从 22M 单元降至 600K 单元)。
- 对长上下文嵌入的近似(分块最大值)在性能上优于直接编码整个长单元。
- 以 GPT-4o 作为长阅读器在 NQ 上获得了在所测试阅读器中最高的 EM(62.7),其他阅读器的性能也接近。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。