Long Context vs. RAG for LLMs: An Evaluation and Revisits

Xinze Li, Yixin Cao, Yubo Ma, Aixin Sun
12/27/2024
cs.CL

No official code found. Best implementation: lixinze777/LC_VS_RAG (11 stars, last commit 2025-01-09).

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.

View on arXivView PDF

Code Implementations(1)

Offcial Page for Long Context vs. RAG for LLMs: An Evaluation and Revisits

113Shell, PythonJul 1, 20241 years ago

Similar Papers

Cite this paper

@article{li2024long,
  title  = {Long Context vs. RAG for LLMs: An Evaluation and Revisits},
  author = {Xinze Li and Yixin Cao and Yubo Ma and Aixin Sun},
  year   = {2024},
  eprint = {2501.01880},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2501.01880v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2501.01880.svg)](https://codeofpaper.com/paper/2501.01880)

Discussion