RAG vs CAG in 2026: What the Paper Actually Says, and What Everyone Misquotes

Every few months a chart goes around claiming Cache-Augmented Generation is “40x faster than RAG,” and another round of “RAG is dead” posts follows. I finally sat down with the actual CAG paper, the long-context research it depends on, and the current provider pricing — and the honest picture is far more interesting than the headline. CAG is a real, measurable win — but only inside a narrow box, and its famous speedup was never measured against RAG at all. If you’re deciding how to ground an AI system this quarter, this is the technical brief I wish someone had handed me.

What I’ll Cover in This Blog

✔️ What RAG and CAG actually are, mechanically — including what a KV cache really caches
✔️ The CAG paper’s own numbers: accuracy, latency, and the misquoted 40x
✔️ The long-context reality: advertised windows vs effective windows
✔️ The cost math with current prices, verified
✔️ What this means for the “RAG is dead” argument

Now, let’s dive in! 🔥

The Two Mechanisms, Honestly Described

RAG (Retrieval-Augmented Generation) — introduced by Lewis et al. at Meta FAIR in 2020 — is the pipeline you know: chunk documents, embed them, index them (vector, BM25 lexical, or hybrid). At query time, retrieve the top-k relevant chunks, optionally rerank, inject them into the prompt, generate. The model only ever sees a small, query-specific slice of the corpus — which means quality lives or dies on retrieval. If the right chunk isn’t fetched, the model can’t use it.

CAG (Cache-Augmented Generation) — from Chan et al., “Don’t Do RAG” — takes the opposite bet: skip retrieval entirely. Preload the whole curated knowledge base into the context once, run one forward pass over it, and save the transformer’s KV cache — the key/value tensors every layer computed for those tokens. Because attention is causal, a fixed document prefix always produces identical KV tensors, so you compute them once and reuse them for every query. Each new question only pays for its own tokens.

🔹 What the cache saves: the expensive “prefill” pass over the corpus, on every query. That’s real and large.

🔹 What the cache does NOT save: the model still attends over the full cached context for every token it generates. The long-context compute cost per generated token — and every long-context quality risk — stays.

🔹 The commercial version: provider “prompt caching” is the managed-API form of the same idea, with two catches — caches are ephemeral (TTL-bound: minutes to an hour, depending on provider and tier) and a cache hit requires a byte-identical prefix. One timestamp at the top of your prompt breaks every hit.

RAG and CAG mechanisms side by sideRAG chunks, embeds and indexes documents, retrieves top-k chunks per query and generates over a small prompt; CAG preloads the whole corpus once into a precomputed KV cache and every query attends over the full cached context.Two Ways to Give a Model Your KnowledgeRAG — retrieve a slice per queryOffline: chunk → embed → indexvector · BM25 · hybridPer query: retrieve top-k → rerankmodel sees a few thousand tokensGenerate over the small promptfast · cheap · bounded by retrieval recallFailure mode: the right chunk wasn’t retrievedCAG — preload everything onceOnce: whole corpus → one forward passKV cache saved (the “prefill” paid once)Per query: load cache + new tokens onlyno retrieval step · no retrieval missesGenerate attending over the FULL contextlong-context cost & risks remain per tokenFailure mode: corpus outgrows the effective windowSame goal, opposite bets: pay retrieval per query, or pay attention over everything per token.abubakarsolutions.com
RAG and CAG side by side: opposite bets on the same problem, by Abubakar Asif

What the Paper Actually Measured

The setup: Llama 3.1 8B, corpora between 21K and 85K tokens from HotPotQA and SQuAD, BERTScore for accuracy, RAG baselines at various top-k. Three findings deserve to be quoted accurately, because almost nobody does:

🔹 Accuracy: CAG won most configurations — by 1 to 3 BERTScore points, on easy datasets. The authors themselves note that sparse BM25 beating dense retrieval “suggests that the datasets may not be sufficiently challenging.” And on the largest corpus (85K tokens), RAG won — the authors concede the gap “narrows” as data grows, and link it to long-context degradation.

🔹 **Latency: the famous 40x is CAG vs uncached long context — not vs RAG. On the large set: uncached in-context loading took 92.08s, CAG took 2.26s. That’s the headline number. But sparse RAG top-3 took ~0.67s — faster than CAG** — because it generates over a few chunks instead of attending over 85K tokens. The misquote (“40x faster than RAG”) reverses the paper’s own table.

🔹 The authors’ own boundary: the approach “becomes impractical for significantly larger datasets,” and they explicitly suggest hybrids — “preload a foundation context and use retrieval only to augment edge cases.”

The honest latency comparison from the CAG paperOn the 85K-token test set, sparse RAG answered in about 0.67 seconds, CAG in 2.26 seconds, and uncached in-context loading in 92 seconds — the famous 40x speedup compares CAG to the uncached case, not to RAG, which was actually faster than CAG.The 40x Everybody Misquotes (85K-token corpus)Sparse RAGtop-3~0.67 s — the fastest in the tableCAGprecomputed KV cache2.26 s — attends over all 85K tokensNo cachere-reads corpus every query92.08 s — THIS is what the “40x” compares againstCAG’s 40x win is over uncached long context. Against RAG, it lost the latency race.Source: Chan et al., arXiv 2412.15605 v2, HotPotQA-large latency table.abubakarsolutions.com
The honest latency chart: what the CAG paper’s 40x actually compares, by Abubakar Asif

One more accuracy note for anyone citing this in a deck: the results are one 8B model, one metric (BERTScore), corpora capped at 85K tokens. It’s a solid proof of concept. It is not an enterprise benchmark.

The Long-Context Reality: Effective vs Advertised

CAG’s whole premise is “the corpus fits in context.” The research record says: check which context — the one on the pricing page, or the one the model actually handles well?

🔹 Lost in the Middle (Liu et al., TACL 2024): accuracy follows a U-shaped curve — models use information at the start and end of context far better than the middle. Multi-document QA dropped by more than 20% in the worst cases, sometimes below closed-book performance.

🔹 RULER (NVIDIA): despite perfect needle-in-a-haystack demos, “almost all models exhibit large performance drops as the context length increases.” The CAG paper itself cites RULER to size Llama 3.1’s effective length at 32K (8B) and 64K (70B) — against a 128K advertised window.

🔹 Databricks Mosaic (Nov 2024, 20 LLMs): “only a handful of the most recent state of the art LLMs can maintain consistent accuracy at long context above 64k tokens.” Chroma’s 2025 “Context Rot” study found the same shape across 18 frontier models (worth noting: Chroma sells retrieval infrastructure — but the neutral academic results agree).

🔹 The frontier has largely converged on ~1M-token advertised windows as of this year — and every one of these studies says to plan capacity well below the sticker number.

Advertised versus effective context windowsAdvertised windows reach a million tokens, but research places reliable effective capacity far lower — RULER sized Llama 3.1 at 32K to 64K effective against a 128K advertised window, and multiple studies show degradation above 64K.Advertised Window vs. Where Accuracy Actually LivesADVERTISED: ~1M tokens on today’s frontier modelsRELIABLE: ~100–200KDEGRADINGU-curve · lost in the middlepaid for, rarely dependable for dense recall across the middle• RULER: Llama 3.1 advertised 128K → effective 32K (8B) / 64K (70B) — cited by the CAG paper itself• Databricks (20 LLMs): consistent accuracy above 64K is the exception, not the rule• Lost in the Middle: mid-context facts can underperform closed-book answeringSize CAG to the effective window, not the pricing page.abubakarsolutions.com
Advertised vs effective context: the constraint that sizes CAG, by Abubakar Asif

The practical translation: treat roughly 100–200K tokens as the honest ceiling for “just put it all in context” — which happens to match Anthropic’s own guidance in its Contextual Retrieval post: a knowledge base under ~200K tokens (about 500 pages) can simply ride in the prompt, “with no need for RAG.” That same post, by the way, is retrieval’s best recent result: contextual embeddings plus reranking cut top-20 retrieval failures by 67%. Both sides of this debate are improving.

The Cost Math, Verified

Provider prompt caching changed the economics this year — cached reads now cost roughly a tenth of normal input at the major providers. Here’s the worked example on current, verified Claude pricing (Sonnet 5 at $2/MTok input, cache reads at 0.1x, 5-minute cache writes at 1.25x — as of September 2026):

Approach for a 500K-token corpus Input cost per query
Uncached long context ~$1.00
CAG via prompt caching (warm cache) ~$0.10 (+ $1.25 per cache write)
RAG retrieving ~5K tokens ~$0.01

🔹 Caching pays for itself after about two warm reads — a genuine 90% saving over naive long context.
🔹 But cached CAG still costs ~10x more input per query than RAG, because you pay for the whole corpus on every call, discounted or not. At enterprise query volumes that gap compounds.
🔹 RAG isn’t free either — embeddings, a vector store, a reranker — so compare total cost of ownership, not just tokens. But the per-query asymmetry is structural.

So… Is RAG Dead?

Here’s my read after all of it, and it’s the same conclusion I reached about model size in You Don’t Need a Bigger Model: the loudest framing is the wrong question.

Naive top-k vector RAG is fading. Retrieval is not. Agentic search — a model running grep, calling tools, querying systems at answer time — is retrieval; what changed is who decides what to fetch. Long context raised the threshold at which a retrieval pipeline becomes necessary; it didn’t remove the need. And the strongest voices on each side of the “RAG is dead” fight are, respectively, long-context enthusiasts and retrieval vendors — read the incentives before you read the benchmarks.

What the evidence supports is a workload decision, not a funeral: cache the stable, retrieve the volatile. I’ve turned that into a full decision framework — thresholds, the five CAG conditions, the hybrid prompt anatomy — in part two, and into a real company story in part three.

Conclusion

✔️ CAG = long context + KV-cache reuse. It skips prefill, not attention — the costs and risks of long context remain.
✔️ The 40x is real but misquoted: it’s CAG vs uncached prompting. In the paper’s own table, sparse RAG was faster than CAG.
✔️ Accuracy favored CAG by 1–3 points on easy sets — and flipped to RAG at 85K tokens, exactly where long-context degradation predicts.
✔️ Effective windows are the binding constraint: ~32–64K for the paper’s own model, well under advertised limits across the industry.
✔️ Cached CAG ≈ 10x RAG’s input cost per query on current verified pricing, even with 90% cache discounts.
✔️ The right question was never “is RAG dead” — it’s “which parts of my knowledge are stable enough to cache, and which are too big, too fresh, or too permissioned to be anything but retrieved?”

Read the paper, not the screenshots of the paper.

Connect with me on LinkedIn →

Deciding between long context and retrieval for a real system right now? Tell me your corpus size, churn rate, and permission model — those three answers usually decide it.

What’s the most confidently misquoted benchmark you’ve seen in an AI architecture debate? Tell me on LinkedIn.

About the Author — Abubakar Asif

SALESFORCE ARCHITECT · AI SPECIALIST · CLOUD ARCHITECT · PAKISTAN

Abubakar Asif — Salesforce Solution Architect, AI & Cloud Specialist based in Pakistan

Abubakar Asif is a Salesforce Solution Architect and artificial intelligence, Google Cloud and CRM specialist based in Pakistan — a top-rated AI, cloud infrastructure and Salesforce expert, and a National AI Research Engineer. He began as a core member and AI researcher with Google Developer Group, known for AI-powered brain-state recognition research, then built AI models and the applications around them for STEM education with STEM Wizards Academia, Toronto.

TRUE AI PIONEER · PRE-GENAI ERA

Abubakar is not just an AI adopter — he is a researcher who built models before “AI” became a buzzword. Before ChatGPT, Claude, Grok or Gemini existed, he was training and deploying custom neural networks from mathematical first principles.

A turn toward Salesforce and AI made him a Solution Architect, which opened the rest: CTO at Sunshine AI, where he led the technology and architecture that earned the startup Salesforce Consulting Partner status and drove healthy partner revenue; consultant and lead roles across Australia, Indonesia, the United States and the United Kingdom; and CTO at Shift Financial Planning, building next-generation financial planning powered by AI and Open Banking APIs.

Today he is Chief Technology Officer at Kalala Consulting, leading AI, CRM and cloud architecture — Salesforce, Agentforce, Data 360, Google Cloud and Microsoft Azure — for clients across financial services, healthcare, education and other industries. He writes here at abubakarsolutions.com about Salesforce architecture, Agentforce and AI enablement, Google Cloud, and the data foundations that make all of it work.

Connect on LinkedIn  ·  Work with Abubakar  ·  More about him

About Me

As a Computer Engineering graduate, I have cultivated a diverse skill set in the field of IT over the past four years. My career began with a strong foundation in full-stack application development, which laid the groundwork for my subsequent expertise in artificial intelligence and Salesforce.

Services

Most Recent Posts

Featured Services

Essential Solutions for AI, Cloud & CRM Success

These featured services are the cornerstone of my offerings, designed to address the most critical needs of your business. Each service is crafted to deliver impactful results, ensuring you achieve your AI, cloud, and CRM objectives and drive success.

AI Enablement & AI Agents

From data foundations to production AI: custom agents, automation, and AI systems integrated into the platforms you already run.

Cloud Infrastructure & Architecture

Google Cloud and Azure environments designed to run your CRM, data, and AI workloads as one secure, cost-aware system.

Salesforce Implementation & Development

End-to-end implementation, customization, data migration, and integration that make Salesforce your unified system of record.

Support and Maintenance

Comprehensive support and ongoing optimization to keep your AI, cloud, and CRM systems performing at their best.

TRUE AI PIONEER · PRE-GENAI ERA - a researcher, not just an adopter. Before ChatGPT, Claude, Grok, or Gemini, he was training and deploying custom neural networks from mathematical first principles.

Award-Winning AI & Neurotech Innovation

AI Based Brain State Recognition

  • Self-Acquired Dataset

    EEG/EOG signals collected from 10 subjects using KL710 Biomedical Kit.

  • Dual-State Recognition

    Eye state classification via EOG & emotional state detection (happiness, sadness, depression, normal) via EEG.

  • Breakthrough in Neurotech & AI

    Achieved 98.3% accuracy in brain state classification using advanced machine learning models.

  • Recognized & Awarded Funding

    My project "AI-Based Brain State Recognition using EOG and EEG Signals" received funding under NGIRI-2024-25 by the Government of Pakistan and was praised for its innovation and impact by the Pakistan Engineering Council (PEC).

Feedback

What People Think About Me

Your Partner in AI, Cloud & CRM

Unlock the full potential of your AI, cloud, and CRM stack by hiring a dedicated architect.

Abubakar Does AI, Cloud & CRM!

Services

AI Enablement

Cloud Infrastructure

Salesforce

Administrator & Developer

Follow For Updates

© 2026