about
Long Context vs. RAG for LLMs: An Evaluation and Revisits (arxiv.org)
3 points by Jimmc414 on Jan 6, 2025 | hide | past | pdf | 4 comments on HN

In plain words: Two ways to give a chatbot extra knowledge were compared: reading whole long documents, or pulling out only the relevant pieces. After dropping questions answerable without documents, reading everything answered more correctly, especially on Wikipedia, while pulling pieces won on dialogue and general queries.

Abstract

Extending context windows (i.e., Long Context, LC) and using retrievers to selectively access relevant information (i.e., Retrieval-Augmented Generation, RAG) are the two main strategies to enable LLMs to incorporate extremely long external contexts. This paper revisits recent studies on this topic, highlighting their key insights and discrepancies. We then provide a more comprehensive evaluation by filtering out questions answerable without external context, identifying the most effective retrieval methods, and expanding the datasets. We show that LC generally outperforms RAG in question-answering benchmarks, especially for Wikipedia-based questions. Summarization-based retrieval performs comparably to LC, while chunk-based retrieval lags behind. However, RAG has advantages in dialogue-based and general question queries. These insights underscore the trade-offs between RAG and LC strategies, offering guidance for future optimization of LLMs with external knowledge sources. We also provide an in-depth discussion on this topic, highlighting the overlooked importance of context relevance in existing studies.

Xinze Li, Yixin Cao, Yubo Ma, Aixin Sun
arXiv:2501.01880 · cs.CL · submitted Dec 27, 2024
abstract · pdf · html · 14 pages excluding references and appendix

add comment on HN

aren't they the same thing? YOu query your RAG database first and pass that info along with your prompt? At least that's how I saw it done on youtube.
Long Context: Everything is loaded into the prompt at once.

RAG: Dynamically fetches only the most relevant pieces of information using semantic search.

Isn’t there a limit to the size of the prompt?
Yes, that’s one of the advantages of RAG as it helps you dynamically feed text into the model based on semantic similarity to the question as opposed to sending all text into the context window.