LongRAG: Enhancing Retrieval-Augmented Generation with Long-context LLMs

Ziyan Jiang,Xueguang Ma,Wenhu Chen
2024-09-02
Abstract:In traditional RAG framework, the basic retrieval units are normally short. The common retrievers like DPR normally work with 100-word Wikipedia paragraphs. Such a design forces the retriever to search over a large corpus to find the `needle' unit. In contrast, the readers only need to generate answers from the short retrieved units. The imbalanced `heavy' retriever and `light' reader design can lead to sub-optimal performance. The loss of contextual information in the short, chunked units may increase the likelihood of introducing hard negatives during the retrieval stage. Additionally, the reader might not fully leverage the capabilities of recent advancements in LLMs. In order to alleviate the imbalance, we propose a new framework LongRAG, consisting of a `long retriever' and a `long reader'. In the two Wikipedia-based datasets, NQ and HotpotQA, LongRAG processes the entire Wikipedia corpus into 4K-token units by grouping related documents. By increasing the unit size, we significantly reduce the total number of units. This greatly reduces the burden on the retriever, resulting in strong retrieval performance with only a few (less than 8) top units. Without requiring any training, LongRAG achieves an EM of 62.7% on NQ and 64.3% on HotpotQA, which are on par with the (fully-trained) SoTA model. Furthermore, we test on two non-Wikipedia-based datasets, Qasper and MultiFieldQA-en. LongRAG processes each individual document as a single (long) unit rather than chunking them into smaller units. By doing so, we achieve an F1 score of 25.9% on Qasper and 57.5% on MultiFieldQA-en. Our study offers insights into the future roadmap for combining RAG with long-context LLMs.
Computation and Language,Artificial Intelligence
What problem does this paper attempt to address?
The paper aims to address the imbalance in the traditional Retrieval-Augmented Generation (RAG) framework, where the retriever needs to handle a large number of short text fragments to find relevant information, while the generator only needs to extract answers from these short fragments. This design leads to an excessive burden on the retriever, and short text fragments may result in the loss of contextual information, thereby affecting overall performance. To solve this problem, the authors propose the LongRAG framework, which significantly reduces the number of retrieval units by using longer retrieval units (typically entire documents or combinations of related documents), thereby alleviating the burden on the retriever. This approach not only improves retrieval quality but also fully leverages the capabilities of the latest long-text processing language models. Experimental results show that LongRAG achieves performance comparable to or even better than top fully supervised models on multiple datasets. Additionally, the paper demonstrates the effectiveness of LongRAG on non-Wikipedia datasets, further validating its generalizability.