RAG 编年史:检索器、块与生成器
The Chronicles of RAG: The Retriever, the Chunk and the Generator
AI总结:
本文面向巴西葡萄牙语场景,提出实现、优化和评估 RAG 的良好实践,通过多种检索方法和 GPT-4、Gemini Pro 等模型,将 MRR@10 提升 35.4%,最终相对得分从 57.88% 提升至 98.61%。
摘要:
检索增强生成(RAG)已成为使大语言模型(LLM)能够访问外部数据的最流行范式之一,同时也作为一种 grounding 机制以缓解幻觉。在实现 RAG 时,可能面临若干挑战,例如检索模型的有效集成、高效的表示学习、数据多样性、计算效率优化、评估以及文本生成质量。鉴于这些挑战,每天都会出现一种改进 RAG 的新技术,使得针对具体问题试验所有组合变得不可行。在此背景下,本文提出了面向巴西葡萄牙语的 RAG 实现、优化和评估的良好实践,重点在于建立一个用于推理和实验的简单流水线。我们探索了多种方法来回答关于《哈利·波特》第一本书的问题。为生成答案,我们使用了 OpenAI 的 gpt-4、gpt-4-1106-preview、gpt-3.5-turbo-1106 以及 Google 的 Gemini Pro。在关注检索器质量方面,与基线相比,我们的方法将 MRR@10 提升了 35.4%。在优化应用中的输入规模时,我们观察到还可以进一步将其提升 2.4%。最后,我们给出了包含我们建议的 RAG 完整架构。结果,我们从 57.88% 的基线提升到了 98.61% 的最高相对得分。
英文摘要:
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%.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。