All field notes
Retrieval and context10 min read

Long Context or RAG: How to Choose the Right Approach

Use long context when the relevant material is bounded, coherent, and small enough to inspect as one working set. Use RAG when the corpus is large, changing, permissioned, or needs precise source selection. For many serious workflows, the practical answer is a hybrid: retrieve a small set of candidate documents, then let the model reason across their fuller context.

By Sahil Maheshwari

A question branching toward a bounded long-context document set or a retrieval path, then reconnecting both routes to cited source evidenceSOURCESConnected contextrelationships stay visibleSYNTHESIS

The short answer: choose around the evidence path

The long context versus RAG decision is not a contest between two model features. It is a choice about how evidence reaches the model. A long-context system places a large body of material directly in the prompt. A RAG system searches an external collection and sends selected passages or documents. One can avoid retrieval misses; the other can avoid filling every request with irrelevant material.

Start with the shape of the job. If a lawyer is comparing three versions of one contract, loading the complete set may preserve definitions, cross-references, and narrative order better than retrieving isolated clauses. If an operations team searches hundreds of thousands of policies, tickets, and manuals that change weekly, retrieval provides a necessary selection layer. Neither choice guarantees a grounded answer. Both still need source identity, permissions, citations, and tests built from real questions.

Do not choose by advertised context-window size. Capacity says how many tokens a model accepts, not how reliably it uses them or whether the evidence is current. Choose the smallest path that gives the model enough context to answer and a reviewer enough context to verify.

Long context changes the amount a model can read. RAG changes which material it reads. The design question is which failure you can detect and control.

Understand what each approach removes and introduces

Long context simplifies the pipeline. There is no separate embedding model, index, chunk ranking, or reranker between the question and the source set. That matters when an answer depends on relationships spread across one report or a small case file. The model can inspect surrounding text instead of requiring a retriever to anticipate every relevant piece.

The simplicity moves risk rather than eliminating it. Irrelevant pages consume attention and input budget. Repeated facts can crowd the prompt. A complete corpus may be too large, too sensitive, or too volatile to send on every request. The Lost in the Middle study found that performance on its multi-document QA and key-value tasks changed with the position of relevant evidence, with material in the middle often used less reliably. Newer models may behave differently, so treat this as a testable warning rather than a permanent law.

RAG adds a visible selection step. That step can make a large collection usable and reduce the text sent to the model. It can also fail before generation begins: the right document may be missing, the chunk may lose its qualifier, or the ranking may prefer a similar but outdated source. Retrieval scores do not prove that the returned evidence is complete. A polished answer can conceal an empty evidence set.

Use long context for bounded, coherent source sets

Long context is strongest when you can name the source set before the question arrives. Examples include one research paper and its appendices, a meeting transcript with its briefing pack, a claim file for one case, or several versions of a policy being compared. The material shares an identity and a task boundary. Reading it together preserves sequence, definitions, exceptions, and references that chunk-level retrieval may separate.

The LOFT benchmark tested long-context models on retrieval and reasoning over very large corpora. Its experiments found that long-context models could rival specialised retrieval systems on several tasks, while compositional reasoning remained challenging and efficiency sat outside much of the quality comparison. The result supports testing direct context; it does not justify loading every private corpus into a prompt.

Test effective context, not nominal context. RULER expanded simple needle tests into multi-needle, multi-hop, and aggregation tasks. In its evaluation of 17 models, performance generally fell as length and task complexity increased, even when the advertised window was much larger. A model finding one planted sentence says little about whether it can reconcile ten clauses, calculate a set difference, or notice that an amendment changes an earlier rule.

Long context becomes less attractive when the same large prefix must be processed for every unrelated question, when documents change between requests, or when a user may see only part of the corpus. Caching can alter the cost and latency equation, but it does not solve stale content or access control.

  • Prefer it when the whole source set fits with comfortable room for instructions and output.
  • Prefer it when global structure or cross-document comparison is central to the answer.
  • Avoid assuming that accepted tokens are equally usable tokens.
  • Keep page, section, document, and version markers inside the context for citation.

Use RAG for large, changing, or permissioned knowledge

RAG earns its complexity when the source collection cannot sensibly travel with every question. Retrieval can narrow millions of passages to a reviewable evidence packet. It can filter by tenant, team, jurisdiction, effective date, document type, or product before semantic ranking. An index can update incrementally as material arrives, while the generation prompt stays within a controlled size.

This is useful for lookup and monitoring: which current policy applies, what changed, or where a requirement appears. Keep document identity and version metadata attached to every retrieval unit. Apply permissions before or during search, not after the model has seen the text.

RAG is weaker when a question needs broad coverage and the retriever cannot express that need. ‘What themes recur across these interviews?’ is different from ‘Which interview mentions delayed approval?’ A similarity search may find vivid examples while missing the full distribution. The first question may need a curated source set, hierarchical summaries, graph relationships, or long-context reading after retrieval.

A 2024 EMNLP comparison of RAG and long context found long context stronger on average in its sufficiently resourced experiments, while RAG used substantially less computation. Its Self-Route method used RAG first and escalated questions judged unanswerable to long context. The useful idea is routing. The exact result belongs to those datasets, models, prompts, and prices; production choices should be re-measured.

Build a hybrid around document retrieval and expansion

A practical hybrid separates selection from reading. First retrieve candidate documents or sections using lexical, semantic, metadata, and permission signals. Then expand the strongest matches into their parent sections, complete documents, or a connected case bundle. The model receives enough surrounding material to reason without receiving the whole organisation's archive.

This design also helps when chunks are too small. LongRAG tested longer retrieval units and long-context readers, including grouped 4,000-token units for Wikipedia tasks and whole documents for two long-document datasets. Its results are task-specific, but the architecture exposes a useful middle ground: retrieval does not have to mean handing the reader a few detached paragraphs.

Route with observable signals: corpus size, candidate count, question type, expected evidence breadth, retrieval score gaps, and whether required entities appear. Escalate when retrieval coverage looks weak. Ask a human when the source boundary is contested. Log which route ran and which evidence entered the answer.

The 2025 LaRA benchmark compared RAG and long context across 2,326 cases, four QA task categories, three kinds of long text, and eleven models. Its central finding was conditional: the better route depended on model capability, length, task, and retrieval characteristics. That is a stronger design premise than a permanent global switch.

Retrieve to establish a source boundary; expand to restore the context needed for reasoning. Preserve the path between both steps.

Include freshness, permissions, cost, and reviewability

Benchmarks rarely capture the whole operational decision. Long context may reduce indexing work but increase repeated input, latency, and exposure of unrelated material. RAG may lower prompt volume but add ingestion jobs, index drift, lineage, and retrieval debugging. Because pricing and caching change, record measured tokens, latency, and failure rates.

Freshness has different failure modes. A long-context request is current only if the assembled source set is current. A RAG answer is current only if ingestion, indexing, filters, and version rules are current. In both cases, show the effective date and version used. Do not quietly combine a superseded clause with a current manual because both matched the query.

Reviewability should break close decisions. A small context containing complete documents can be easy to audit. A retrieval system can be easier to audit at scale because it records ranked candidates and source locators. Whichever route you use, a reviewer should see the question, eligible source set, selected evidence, excluded or superseded versions, generated claim, and citation.

Evaluate long context and RAG on the same questions

Build three honest baselines: direct long context over the eligible source set, RAG with fixed retrieval and context budgets, and a hybrid that retrieves then expands. Run them on the same model where possible. Use questions that represent lookup, comparison, aggregation, multi-hop reasoning, changing facts, inaccessible documents, and cases with no answer.

Score the evidence path separately from the prose. For RAG, ask whether the required source appeared, whether ranking introduced stale or redundant material, and whether expansion recovered necessary context. For long context, vary document order and evidence position, then test whether the model covered all required sources rather than one convenient passage. For both, measure answer correctness, claim-level support, citation precision, abstention, latency, and cost.

Slice results by task and corpus shape. An average can hide a retriever that excels at lookup but misses whole-corpus themes, or a long-context system that handles one dossier well but drifts across a larger collection. Re-run when the model, prompt, document mix, or pricing changes.

The useful outcome is not ‘RAG wins’ or ‘long context wins’. It is a routing rule you can explain: for this source boundary and question type, use this path; when these signals fail, widen the context or request review. If you are working through a real knowledge task where that boundary is unclear, share the documents, question, and failure pattern at sahil@granveo.com.

  • Evidence recall: did the route expose every source needed for a defensible answer?
  • Evidence precision: how much supplied material was relevant rather than distracting?
  • Faithfulness: does each material claim follow from the cited source and version?
  • Robustness: does the result survive order changes, paraphrased questions, and missing evidence?
  • Operations: can the team update, authorize, inspect, and reproduce the evidence path?

Sources and further reading

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

    Li et al., EMNLP 2024Compares RAG and long-context models across public datasets and introduces Self-Route as a cost-aware hybrid.

  2. 2
    LaRA: Benchmarking Retrieval-Augmented Generation and Long-Context LLMs

    Li et al., ICML 2025Shows that the preferred route varies with model capability, context length, task type, and retrieval characteristics.

  3. 3
    Lost in the Middle: How Language Models Use Long Contexts

    Liu et al., TACL 2024Demonstrates position-sensitive use of relevant information in long-context question answering and retrieval tasks.

  4. 4
    RULER: What's the Real Context Size of Your Long-Context Language Models?

    Hsieh et al., COLM 2024Extends needle tests with multi-hop and aggregation tasks and measures degradation as context and complexity grow.

  5. 5
    Can Long-Context Language Models Subsume Retrieval, RAG, SQL, and More?

    Lee et al., 2024Introduces LOFT and tests long-context models against specialised systems on retrieval and reasoning tasks.

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

    Jiang, Ma, and Chen, 2024Explores longer retrieval units paired with long-context readers across open-domain and long-document QA.

Continue the conversation

Where does context get lost in your work?

I am speaking with researchers, founders, and operators about the handoffs, evidence, and decisions that are hardest to keep connected.