Skip to main content
QUICK REVIEW

[Paper Review] The Chronicles of RAG: The Retriever, the Chunk and the Generator

Paulo Finardi, Leonardo Avila|arXiv (Cornell University)|Jan 15, 2024
Topic ModelingComputer Science15 citations
TL;DR

This paper studies how to design, optimize, and evaluate Retrieval Augmented Generation (RAG) pipelines for Brazilian Portuguese, comparing multiple retrievers (sparse, dense, hybrid) and a reranker, and reporting a best-practice end-to-end configuration achieving high relative performance on a Harry Potter dataset.

ABSTRACT

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%.

Motivation & Objective

  • Propose a methodology to prepare a dataset and quantify RAG steps for Brazilian Portuguese.
  • Introduce a metric (relative maximum score) to quantify gaps to a perfect RAG system.
  • Evaluate diverse retrievers and pipeline architectures to establish best practices for RAG in Portuguese.

Proposed method

  • Create a 140-question QA dataset from Brazilian Portuguese Harry Potter using 1000-token chunks.
  • Define a relative maximum score to measure the potential performance of RAG configurations.
  • Evaluate baseline (no context), long-context prompts, and naive RAG against multiple retrievers (BM25, ADA-002 dense, custom ADA-002), including hybrid and multi-stage reranking.
  • Use recall-based metrics (R@k) and MRR@k to compare retrievers.
  • Implement a retrieve-and-rerank multi-stage architecture with BM25 as first stage and mt5-based reranker for second stage.
  • Experiment with input size (number of retrieved chunks) and position of answer within the prompt to study context effects.

Experimental results

Research questions

  • RQ1How do different retrievers (sparse, dense, hybrid) affect RAG performance in Brazilian Portuguese?
  • RQ2What is the impact of chunking strategy and answer positioning on RAG quality?
  • RQ3Can a retrieve-and-rerank multi-stage pipeline outperform baseline and naive RAG configurations in this setting?
  • RQ4What is the relationship between input size and RAG performance, and what is an optimal number of chunks to retrieve?

Key findings

  • Dense and hybrid retrievers significantly improve RAG performance over a naive baseline, with MRR@10 improvements up to about 35.4 percentage points over baseline.
  • Input size optimization can yield an additional ~2.4% performance gain.
  • A multi-stage BM25-first with a neural reranker (mt5-based) achieving 3 retrieved chunks achieved the best results, approaching state-of-the-art in this setup.
  • Final best configurations achieved a relative maximum score of 98.61%, a substantial improvement over the baseline (40.73 points in the degradation score).
  • The study demonstrates a strong link between retriever quality and overall RAG performance, and emphasizes careful input construction and evaluation frameworks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.