500KB ~= 125K tokens. It fits a 200K window but pays full cost per call and hits lost-in-the-middle. RAG retrieves only 5K-10K relevant tokens per query, cutting cost 10x to 25x and keeping high-recall positions.
Imagine you have a 1,200-page reference book and somebody asks you a question. You could carry the whole book to the meeting every time, but it is heavy, you only read a few pages, and you tend to forget what was on the pages in the middle. RAG is the librarian who hands you only the three pages relevant to the question. Context stuffing is dragging the whole book. The book strategy works if it is a thin pamphlet you read every time, but for a real reference, the librarian wins on weight, on cost, and on actually remembering what you read.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
The 'long context killed RAG' narrative was big in 2024 and has not aged well. Modern frontier models do have 200K to 1M token windows, but the cost, latency, and recall properties of long contexts make stuffing a poor default for anything beyond a small, stable corpus. The 500KB scenario in this question is exactly the shape where the wrong choice looks superficially correct and is structurally wrong.
The deep dive walks through the three quantities that drive the decision (cost, recall, latency), the lost-in-the-middle effect that long-context evals have measured repeatedly, the production RAG pattern that wins on each axis, and the narrow cases where stuffing actually is the right call.
The token math and what it costs
The starting calculation is mechanical. English text averages roughly 4 characters per token on the byte-pair encodings used by Claude and GPT, so 500KB of plain text is around 125K tokens. The number varies with language and content (code is denser, structured JSON is sparser) but 100K to 150K is the right ballpark.
Frontier-model input pricing in 2026 is around $5 per million tokens for Claude Opus 4.7, $1.25 to $2.50 for GPT-5.5, $3 for Claude Sonnet 4.x, $1.25 for Gemini 3.1 Flash. At $5 per million (Opus 4.7), a 125K-token prefix costs $0.63 per call before the model writes a single output token. A small-business app at 10K calls per day is paying $18,800 per day, $5.6M per year, just for the input prefix.
RAG retrieving 5 to 10K tokens per query collapses that to $0.075 to $0.15 per call: a 10x to 25x reduction. At the same 10K calls per day, you are looking at $750 to $1,500 per day. The cost gap is what funds the retrieval infrastructure, the embedding compute, the vector store, and the cross-encoder re-ranker several times over. Prompt caching helps stuffing but does not close the gap unless the cache hit rate is very high and the prefix is genuinely identical across calls.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- Anthropic's prompt-engineering docs explicitly recommend RAG over stuffing for Claude Opus 4.7 once the corpus exceeds a small fraction of the 200K window, citing both cost and recall on the middle of the context.
- Perplexity routes every search through dense plus BM25 retrieval before invoking Claude or GPT-5.5, because stuffing the web index is structurally impossible and even a daily slice would dilute attention.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhen does prompt caching change the math in favor of stuffing?
When the static prefix has 80%+ cache hit rate, the per-call cost of stuffed context drops by roughly an order of magnitude; on small stable corpora this can flip the decision, but not at 500KB.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Treating a 200K window as license to stuff the whole corpus, paying for 125K tokens per call, and shipping a system that quietly misses facts buried in the middle of the prompt.
60 second bullets to scan on the way to the call.
How to estimate token count from byte size (~4 chars per token)
Cost formula: tokens times per million input tokens price
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.