[论文解读] The Chronicles of RAG: The Retriever, the Chunk and the Generator
本论文研究如何为巴西葡萄牙语设计、优化和评估检索增强生成(RAG)流水线,比较多种检索器(稀疏、密集、混合)和重排序器,并报告在哈利波特数据集上实现高相对性能的最佳端到端配置。
Retrieval Augmented Generation (RAG) has become one of the most popular paradigms for enabling LLMs to access external data, and also as a mechanism for grounding to mitigate against hallucinations. When implementing RAG you can face several challenges like effective integration of retrieval models, efficient representation learning, data diversity, computational efficiency optimization, evaluation, and quality of text generation. Given all these challenges, every day a new technique to improve RAG appears, making it unfeasible to experiment with all combinations for your problem. In this context, this paper presents good practices to implement, optimize, and evaluate RAG for the Brazilian Portuguese language, focusing on the establishment of a simple pipeline for inference and experiments. We explored a diverse set of methods to answer questions about the first Harry Potter book. To generate the answers we used the OpenAI's gpt-4, gpt-4-1106-preview, gpt-3.5-turbo-1106, and Google's Gemini Pro. Focusing on the quality of the retriever, our approach achieved an improvement of MRR@10 by 35.4% compared to the baseline. When optimizing the input size in the application, we observed that it is possible to further enhance it by 2.4%. Finally, we present the complete architecture of the RAG with our recommendations. As result, we moved from a baseline of 57.88% to a maximum relative score of 98.61%.
研究动机与目标
- 提出一种方法论,用于准备数据集并量化巴西葡萄牙语的 RAG 步骤。
- 引入一个度量标准(相对最大分数),用于量化通往完美 RAG 系统的差距。
- 评估多样的检索器和流水线架构,以为葡萄牙语中的 RAG 建立最佳实践。
提出的方法
- 使用 1000-token 的块,从巴西葡萄牙语的哈利波特中创建一个 140 题的问答数据集。
- 定义一个相对最大分数,以衡量 RAG 配置的潜在性能。
- 评估基线(无上下文)、长上下文提示和朴素 RAG 对多种检索器(BM25、ADA-002 密集、定制 ADA-002)、包括混合和多阶段重排序的情况。
- 使用基于召回率的指标(R@k)和 MRR@k 来比较检索器。
- 实现一个检索与重排序的多阶段架构,第一阶段使用 BM25,第二阶段使用 mt5 基于的重排序器。
- 通过输入大小(检索到的块数量)和答案在提示中的位置来研究上下文效应。
实验结果
研究问题
- RQ1不同检索器(稀疏、密集、混合)在巴西葡萄牙语中的 RAG 性能有何影响?
- RQ2分块策略和答案位置对 RAG 质量有何影响?
- RQ3在此设置下,检索-并重排序的多阶段流水线能否超越基线和朴素 RAG 配置?
- RQ4输入大小与 RAG 性能之间的关系是什么,检索的最佳块数是多少?
主要发现
- 密集和混合检索器相较于朴素基线显著提升 RAG 性能,MRR@10 相对于基线提升最高约 35.4 个百分点。
- 输入大小优化可再带来约 2.4% 的性能提升。
- 以 BM25 为第一阶段、以神经重排序器(基于 mt5)为第二阶段、检索 3 个块的多阶段方案取得最佳结果,接近该设置下的最先进水平。
- 最终最佳配置实现了相对最大分数 98.61%,比基线有显著提升(降解分数 40.73 点)。
- 该研究显示检索器质量与整体 RAG 性能之间存在强相关性,并强调输入构造和评估框架需谨慎。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。