GraphRAG vs vector RAG: when a knowledge graph is worth the indexing bill
GraphRAG answers whole-corpus questions that vector RAG cannot, but it costs far more to index. How the two differ, what each is good at, and a decision table for choosing.
Long context vs RAG is a size, cost and accuracy decision. When stuffing the whole knowledge base into the prompt works, when it breaks, and how to choose.
You have a pile of documents and you want an AI feature that answers questions about them. Someone on the team points out that models now accept very large prompts, so why build a retrieval pipeline at all? That question, long context vs RAG, is a real architecture decision, and for some products the honest answer is that you can skip retrieval.
This post covers when that is true, where it stops being true, and a short test for choosing. It is about the domain, not any particular deployment; claims are linked to the sources they come from.
Anthropic's write-up on contextual retrieval gives a concrete rule of thumb: if your knowledge base is smaller than 200,000 tokens (about 500 pages of material), you can include the entire thing in the prompt and skip RAG. That is a vendor figure for one model family, so check the current window of whichever model you use, but it frames the right question: how big is the corpus in tokens?
Skipping retrieval is attractive because it removes whole components: no chunking, no embeddings, no vector store, no reranker, no re-indexing when you change embedding models. Every one of those is a place retrieval can quietly miss the right passage. A small, stable corpus such as one product's handbook, a policy set or a single contract bundle is the best case for just passing it in.
Four situations push you back toward retrieval:
On the last point, the "Lost in the Middle" paper (Liu et al., arXiv:2307.03172) found that performance can degrade significantly when the position of relevant information changes, is often highest when it appears at the beginning or end of the input, and drops when the model must use information in the middle. The authors concluded that language models of that time did not robustly use information in long inputs. Newer models may do better, and the paper does not say how much, so treat it as a reason to test your own model on your own documents, not as a verdict.
Long context sends many more input tokens per question; RAG sends few but adds infrastructure. The lever that changes the long-context picture is prompt caching. Anthropic states that caching frequently used prompts between API calls can cut latency by more than 2x and cost by up to 90%. That makes the "stuff it all in" design viable when the same knowledge base prefix is reused across many requests.
The caveat is the word reused. Caching rewards a stable prefix. If your corpus is per-user or edited constantly, you pay for the full input far more often. Our posts on prompt caching and reducing LLM API costs cover the mechanics, and the arithmetic is simple to run yourself: tokens per query, times queries per month, times your provider's current input price, with and without a cache hit rate you have actually measured.
Latency moves the same way. Large inputs add processing time before the first token, which matters for interactive features; see LLM latency and time to first token.
| Factor | Long context (no retrieval) | RAG |
|---|---|---|
| Corpus size | Must fit the model's window | Effectively unbounded |
| Moving parts | Prompt assembly only | Chunking, embeddings, index, reranking |
| Data freshness | Instant if you rebuild the prompt | Depends on re-indexing |
| Per-user access control | You filter before building the prompt | Filter at retrieval time |
| Cost per query | High input tokens; caching helps if stable | Low input tokens plus retrieval infra |
| Main failure mode | Answers degrade as the prompt grows | Retrieval misses the right passage |
| Citations | Harder; you must ask for them | Natural: you know which chunks were sent |
Then run an evaluation. Take 30 to 50 real questions with known answers, run them through both designs, and compare accuracy, cost and latency. Put answer positions in the middle of the corpus on purpose. The process for building that set is in LLM evals in CI and prompt regression testing.
There is also a middle path: use retrieval to select the few most relevant documents, then pass those whole rather than as small chunks. It trades some of RAG's cost savings for fewer chunking mistakes. If you stay with chunks, see RAG chunking strategy and hybrid search and reranking. For the broader choice between grounding approaches, read RAG vs fine-tuning.
If you are building a document-grounded feature into a product and want help choosing the architecture, see our AI SaaS development service and get in touch.
Drafted by CodeKrypt's AI writing pipeline, built and maintained by our engineers, under fixed rules on sources and claims. How we write
GraphRAG answers whole-corpus questions that vector RAG cannot, but it costs far more to index. How the two differ, what each is good at, and a decision table for choosing.
How to stop an AI agent infinite loop from burning your LLM budget: step and token budgets, repeated-call detection, wall-clock limits and a per-run kill switch.
A RAG index goes stale the day after launch. How to detect changed and deleted documents, sync incrementally with content hashes, and stop retired policies from being quoted as current.