Back to paper library
Paper notesarXiv 2024EMNLP Industry Track 2024

Self-Route

Knowing When You Don't Know

Original paper

Retrieval Augmented Generation or Long-Context LLMs? A Comprehensive Study and Hybrid Approach

Paper authors

Zhuowan Li · Cheng Li · Mingyang Zhang · Qiaozhu Mei · Michael Bendersky

Publication
EMNLP Industry Track 2024Conference
First submitted to arXiv
arXiv:2407.16833
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{retrievalaugmentedgenerationselfroute2024,
  title = {{Retrieval Augmented Generation or Long-Context LLMs? A Comprehensive Study and Hybrid Approach}},
  author = {Zhuowan Li and Cheng Li and Mingyang Zhang and Qiaozhu Mei and Michael Bendersky},
  year = {2024},
  eprint = {2407.16833},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.16833}
}
On this page

By mid-2024, long-context models were advancing quickly.

Gemini 1.5 Pro could take a million tokens, while GPT-4o supported 128K. A document hundreds of pages long could fit directly into the prompt.

Did we still need RAG?

Many teams were asking that question. Giving the model the entire document skips retrieval and sounds simple and reliable. But sending a hundred thousand tokens for every question also produces a substantial bill.

This paper comes from Google DeepMind and the University of Michigan. The authors first compare RAG with long context on the same datasets, then use the findings to design a hybrid.

Defining the Problem

An earlier comparison by Xu et al. (2023) concluded that long-context models still lagged behind RAG. These authors argue that models have improved considerably over the past year, so that conclusion deserves another look.

Their first question is:

  • With the latest models, which is more accurate: RAG or long context (LC)?

If LC is more accurate, a second question follows:

  • LC costs more. Can we use it only when needed?

Comparison Setup

The authors select nine English datasets from LongBench and ∞Bench, requiring real text and explicit questions:

  • LongBench: NarrativeQA (novels and scripts), Qasper (papers), MultiFieldQA, HotpotQA, 2WikiMultihopQA, MuSiQue (the last three are Wikipedia multi-hop QA), and QMSum (meeting transcripts).
  • ∞Bench: En.QA and En.MC, averaging about 147,000 words—much longer than the other datasets.

Open-ended QA uses F1, multiple-choice questions use accuracy, and summarization uses ROUGE.

The three models are Gemini-1.5-Pro (one million tokens), GPT-4O (128K, gpt-4o-2024-05-13), and GPT-3.5-Turbo (16K, gpt-3.5-turbo-0125).

The RAG setup follows the standard recipe, splitting long texts into 300-word chunks, using one of two dense retrievers, Contriever or Dragon, to select the top five chunks by cosine similarity to the query, and putting them into the prompt in score order.

Solving the Problem

First, Compare Them: LC Wins

Table 1 of the paper: LC, RAG, and Self-Route scores across nine datasets for Gemini-1.5-Pro, GPT-4O, and GPT-3.5-Turbo, with answerable and token ratios
Table 1 from the paper, excerpted from page 4 of the ACL Anthology PDF, CC BY 4.0. Retrieval uses Contriever. Bold marks the highest score for each model on each dataset.

There is a lot in this table, so start with just the first two rows for each model, *-1 LC and *-2 RAG. The leftmost Avg column averages the nine datasets.

ModelLCRAGGap
Gemini-1.5-Pro49.7037.3312.37
GPT-4O48.6732.6016.07
GPT-3.5-Turbo32.0730.331.74

Calculated from the average scores in Table 1 of the paper.

LC is better for all three models, with larger gaps for newer models.

The only exceptions are GPT-3.5-Turbo on En.QA and En.MC, where RAG scores 15.39 and 43.67 while LC gets only 14.73 and 34.50. These datasets average about 147,000 words, far beyond GPT-3.5-Turbo's 16K-token window. The full documents simply do not fit. The authors also count this as a clear use case for RAG, for inputs far longer than the context window.

An Interesting Finding: They Often Give the Same Answer

Looking only at average scores might suggest “use LC if the budget allows.”

But the authors then compare answers question by question and draw this figure:

Distribution of per-question RAG-minus-LC score differences, with most of the mass at zero
Figure 2 from the paper, excerpted from page 3 of the ACL Anthology PDF, CC BY 4.0. The horizontal axis is RAG score minus LC score on the same question; colors indicate their average score.

The horizontal axis subtracts LC's score from RAG's for each question, with scores scaled to 0–100. The very tall bar at zero shows that on 63% of questions, the two answers are identical; on 70%, the score difference is within ten points.

Now look at the colors. The bottom of that bar is blue: both answers are correct. Its upper portion is red: both are wrong.

RAG and LC frequently succeed together, and frequently fail together too.

If RAG performs as well as LC on most questions, we only need to identify the ones it cannot handle and send those to LC.

Self-Route: Let the Model Say “I Don't Know”

How can we tell which questions RAG cannot handle?

The authors simply ask the model itself.

Self-Route has two steps:

  1. RAG with routing. Give the model the question and retrieved chunks, adding an instruction: “If the question cannot be answered from the provided text, write unanswerable.” If it answers, use that answer.
  2. Long-context prediction. Only questions marked unanswerable are answered again with the full document using LC.

No additional classifier is trained. Routing relies entirely on the model's judgment after reading the chunks. The authors assume it can judge sufficiently accurately whether those chunks support an answer.

How Much Does It Save? Let's Calculate

We can first get a feel for token savings with a simple estimate.

Let the full document length be LL, the retrieved-chunk length be ℓ\ell, and the fraction judged answerable be aa. Every question pays the RAG-and-routing cost ℓ\ell. Unanswerable questions also pay for the full document LL. Average input tokens per question are approximately:

ℓ+(1−a) L\ell + (1-a)\,L

Relative to pure LC's LL, that is:

ℓL+(1−a)\frac{\ell}{L} + (1-a)

The prose gives an example with about 1.5K retrieved tokens and a full document of 10K to 100K tokens. Suppose the document is 100K and the answerable ratio is a=0.77a=0.77:

1.5100+(1−0.77)=0.015+0.23≈25%\frac{1.5}{100} + (1-0.77) = 0.015 + 0.23 \approx 25\%

If a=0.57a=0.57, the ratio becomes about 44%.

This formula ignores instruction and output lengths and only serves to show that savings depend mainly on how often the model is willing to answer from the chunks.

Discussion

Results

Return to Table 1 and look at the last three rows for each model:

ModelLCSelf-RouteAnswerable ratioToken ratio
Gemini-1.5-Pro49.7046.4176.78%38.39%
GPT-4O48.6748.8957.36%61.40%
GPT-3.5-Turbo32.0735.3274.10%38.85%

Compiled from Table 1 of the paper. Token ratio is Self-Route's token usage relative to LC.

GPT-4O uses about 60% of the tokens for almost the same score as LC. Gemini-1.5-Pro uses less than 40%, losing 3.29 points. GPT-3.5-Turbo actually gains 3.25 points over LC, with particularly large gains on the two datasets that exceed 16K, where it scores 22.03 versus 14.73 on En.QA and 44.54 versus 34.50 on En.MC.

All three models judge more than half the questions answerable, which supports the authors' premise that most questions do not need the whole document.

GPT-4O's answerable ratio is noticeably lower, so its token ratio is higher. The authors speculate that alignment plays a role, as OpenAI models are more likely to decline answers based only on chunks, yielding fewer answers but higher accuracy among those answered, while Gemini answers directly more often. This is their interpretation; the paper does not test it further.

Switching to Dragon produces the same trend for Gemini-1.5-Pro, with LC at 49.70, RAG at 38.09, and the hybrid at 46.81; RAG handles 77.88% of questions, and the token ratio is 37.87% (Table 2).

How Many Chunks Should We Retrieve?

As kk increases, RAG sees more chunks and approaches LC's performance, but the routing cost per question rises.

The authors plot the trade-off from k=1k=1 to over 50. At k=1k=1, RAG scores only 20.24, while Self-Route reaches 37.9: the hybrid's advantage is greatest here. Above 50, all three approaches perform similarly.

The cost curve is not monotonic. On average, k=5k=5 is cheapest, because too few chunks send many questions to LC, while too many raise every question's routing cost. The cheapest kk varies by dataset, however. For datasets such as NarrativeQA and QMSum that do not require multi-hop reasoning, k=1k=1 is cheaper.

Why Does RAG Fail?

The authors organize questions that RAG marks unanswerable into four causes, then give Gemini-1.5-Pro a few manually annotated examples to classify all failures:

  • A. Multi-step: The first answer is needed to know what to retrieve next. For example, “What country is the singer of song XXX from?”
  • B. Too general: For example, “What does this group think about XXX?” It is difficult to construct a useful retrieval query.
  • C. Too long and complex: The retriever struggles to understand the whole question.
  • D. Implicit: The answer requires understanding the broader context. In a long conversation about a space voyage, for example, the question asks where the shadow behind the spaceship came from, but the passage explaining it never mentions “shadow.”
RAG failure causes across seven LongBench datasets: multi-step, general, complex, implicit, and other
Figure 4 from the paper, excerpted from page 6 of the ACL Anthology PDF, CC BY 4.0. Each bar's height is the number of failed RAG questions in that dataset.

The causes fit the datasets well.

Blue “multi-step” failures dominate HotpotQA, 2WikiMQA, and MuSiQue, the three Wikipedia multi-hop datasets. NarrativeQA contains long stories rich in dialogue, and green “implicit” almost fills its bar. QMSum asks open-ended questions about meeting transcripts, so red “too general” dominates.

Manual inspection of “other” finds that most are also ambiguous multi-step questions.

If you build RAG systems, you can first identify which kind of question you have, then decide whether to improve retrieval, rewrite queries, or use long context directly. The authors also suggest trying chain-of-thought within RAG for multi-step questions and revisiting query expansion for general and complex ones.

The Trap in Synthetic Data

There is one last small experiment.

∞Bench's PassKey is a needle-in-a-haystack test that hides “the passkey is 123456” in irrelevant text and then asks “What is the passkey”.

QuestionRAGLC
What is the passkey80.3465.25
What is the special token hidden inside the texts4.5869.32
Two passkeys; ask which is larger47.6364.24

Compiled from Table 3 of the paper, using Gemini-1.5-Pro.

RAG wins decisively with the original wording. Merely rephrasing the question as “What is the special token hidden inside the texts” drops RAG from 80.34 to 4.58, while LC barely changes.

The word “passkey” appears in both the question and the hidden sentence, so the retriever matches it at once. Change the wording, and with no matching word, the retriever can no longer find it.

From this, the authors argue that the construction of synthetic datasets can unintentionally swing RAG-versus-LC comparisons dramatically. That is why their main evaluation uses real datasets.

Later Criticism

Self-Route tries RAG first and falls back to LC on failure. Route Before Retrieve, from May 2026, describes such methods as failure-driven fallbacks: reactive, inefficient, and hard to interpret. It proposes choosing a route before answering, using lightweight document information.

This criticism points to a premise of Self-Route, which requires the model to judge correctly, after reading the chunks, whether it can answer. Too optimistic, and RAG returns an incomplete answer; too cautious, and it unnecessarily adds the cost of LC.

Conclusion

The paper's answer comes in two halves.

On accuracy, LC wins. Across nine real datasets, the average LC score exceeds RAG for Gemini-1.5-Pro, GPT-4O, and GPT-3.5-Turbo, with larger gaps for newer models. The exception is when documents greatly exceed the context window, where RAG remains useful.

On cost, mixing the two pays off. Their answers are identical on 63% of questions. Letting the model try retrieved chunks first and use the full document only when it cannot answer gives GPT-4O LC-like performance with about 61% of the tokens. Gemini-1.5-Pro uses about 38%, losing roughly three points.

In addition, RAG failures mainly involve multi-step, general, and implicit questions, and rewording a synthetic test can reverse the winner.

Check the crib sheet first, then open the whole book if needed. It is a plain idea, but its cost depends on how honestly the model says, “I don't know.”