Cost & Pricing·By the Run BiOS team··8 min read

Long Context vs RAG: Where the Cost Crosses Over

On this page

What are the two ways to hand a model your documents?

Every "chat with your data" feature is one of two architectures wearing the other's clothes. The first is long context: put the documents in the prompt and let the model read them. The second is retrieval: keep the documents in an index, find the pieces that matter for each question, and put only those in the prompt.

Long context is having the analyst read the whole filing cabinet. Retrieval is having a clerk fetch three folders first. Both produce an answer with the same API call shape; everything else — the bill, the failure modes, the infrastructure — is different.

The choice is usually argued as a quality debate, and quality matters. But the two options also bill completely differently, and for many workloads the cost question is the one that decides first. This post is about finding the crossover for your traffic rather than adopting whichever pattern your framework demoed.

What does each option actually bill?

Long context bills the corpus, every time. The documents ride inside the prompt, so every request pays input tokens for everything you stuffed in — the relevant pages and the irrelevant ones alike. There is one mitigating force, and it is a big one: a corpus that sits unchanged at the head of the prompt is exactly the shape caches reward, so repeat traffic can pay a discounted rate on the static bulk. The mechanics and the prefix discipline are in the prompt caching post.

Retrieval bills the excerpts plus the machinery. The prompts are small — you pay input tokens only for the pieces actually used — but you are now operating an index: embedding the corpus, storing it, keeping it current as documents change, and running the search itself. That machinery is mostly fixed cost, while the long-context bill is almost entirely per-request.

That is the whole shape of the trade: long context is pay-as-you-go with a volume problem, retrieval is a small per-request bill with an operations mortgage.

Where does the crossover actually sit?

Three workload facts decide it. Corpus size: a small, stable corpus is cheap to stuff; a corpus the size of a documentation library is not, no matter how good the cache discount. Question shape: questions that genuinely require the whole corpus — "summarize everything," "find the contradiction across these filings" — cannot be answered from excerpts, so retrieval is not really an option there. Reuse: high request volume over an unchanging corpus is where caching flips long context from extravagant to obvious.

The arithmetic is worth doing explicitly, because the result is workload-specific: price a representative month both ways, using your real corpus size, request volume, and cache hit rate, at published rates — the pricing calculator takes volumes and split directly. Include the retrieval side's pipeline and maintenance honestly; teams routinely compare "retrieval's token bill" against "long context's token bill" and forget the index has a payroll.

Expect the answer to be lopsided in one direction. It rarely comes out close.

How does the quality side cut both ways?

Long context fails quietly in the middle: models attend best to the beginning and end of very long prompts, and a fact buried deep in the stuffing can be missed without any error to catch. The bigger the prompt, the more this matters — and it shows up as subtly wrong answers, not failures.

Retrieval fails at the fetch: if the retriever does not surface the right passage, the model never had a chance, and the answer will be confidently grounded in the wrong three folders. The failure lives outside the model, which makes it easy to miss in model evaluation and easy to fix once found — but you have to instrument the retrieval step to see it.

Neither failure mode is disqualifying; both argue for evaluating the full pipeline, not the model in isolation, on your real questions. The eval-before-purchase discipline applies here exactly as it does to model choice: the architecture is part of what you are buying.

Why is the hybrid the adult answer?

Production systems usually land on the combination: retrieval narrows a large corpus to a candidate set, and a generous context window absorbs those candidates whole, without forcing the retriever to be surgically precise. Long context acts as forgiveness for imperfect retrieval, and retrieval keeps long context affordable. Each covers the other's characteristic failure.

There is a second, quieter hybrid: a small stable core — instructions, standing policy, the documents every request needs — kept at the cached head of the prompt, with retrieval results appended behind it. That is the cache-shaped layout from the caching post applied to this architecture, and it is worth designing for from day one rather than retrofitting.

What the hybrid is not is an excuse to skip the arithmetic. It optimizes the quality side; the cost crossover still has to be run for your corpus and volume, because the hybrid inherits both bill structures at once.

Which questions answer it for you?

Four questions, in order, usually settle the architecture before any benchmark is run:

  • **How big is the corpus, really?** Measure it in tokens, not in documents or gigabytes. If the whole thing fits comfortably in the context window with room for the conversation, long context is on the table; if it is larger than any window you would actually pay for, retrieval is the only door.
  • **How often does it change?** A corpus revised weekly punishes both options differently: re-stuffing costs tokens, re-indexing costs pipeline. A corpus that barely moves is where long context plus caching is at its strongest.
  • **Do questions need the whole haystack or one needle?** Whole-corpus questions cannot be retrieved into existence; needle questions are wasteful to stuff.
  • **Who operates the index?** Retrieval is not a library you import, it is a system you own. If nobody on the team wants that pager, a smaller per-request bill is buying a larger operational one.

Write the answers down next to the cost arithmetic from the previous section. When the two disagree — cheap architecture, wrong shape — believe the shape. A discounted architecture that cannot answer the question is not cheap.

When is this question premature?

When the corpus fits comfortably in a prompt and traffic is light, do the simple thing: stuff the documents, keep them at the cached head, and spend your engineering time on the product. A retrieval pipeline is a system you will maintain forever; build it when the bill or the quality data demands it, not because the architecture diagram looks more serious.

It is also premature before the feature itself is proven. Plenty of "chat with your data" products discover their users ask the same twenty questions; a workload like that wants caching and maybe a FAQ, not an index.

And when you do outgrow the simple path, grow along the measurement: log prompt sizes, cache hit rates, and which documents actually got used. The crossover for your workload is computed from those numbers, not from a blog post — this one included.

Related Articles