OpenRouter Benchmarks RAG vs. CAG: CAG Scores 31/40 on a 330K-Token Catalog
Summary:OpenRouter compared plain embedding RAG, BM25-hybrid RAG, and cache-augmented generation (CAG) on one outdoor-commerce catalog at roughly 9K, 66K, and 330K prompt tokens, using the same 40 questions. On the largest 3,000-product catalog, CAG with GPT-6 Luna answered 31 of 40 correctly, versus 9 for plain RAG and 17 for hybrid RAG. RAG stayed around $0.13–$0.22 per 1,000 questions, while CAG rose from $0.13 to $8.70 as the catalog grew. On DeepSeek V4.1 Flash, spreading requests across providers
Core Finding
OpenRouter expanded one outdoor-store product catalog to roughly 9K, 66K, and 330K prompt tokens and asked each method the same 40 questions. The runs were conducted through the OpenRouter API on November 8, 2026. The largest catalog contained 3,000 products and produced a clear, conditional advantage for CAG:
| Method | Correct on the largest catalog | Cost per 1,000 questions | Main signal | |---|---:|---:|---| | CAG with GPT-6 Luna | 31/40 | Rose from $0.13 to $8.70 as the catalog grew | Strong local product QA, but costs scale with corpus size | | Plain vector RAG | 9/40 | RAG overall remained around $0.13–$0.22 | Semantic retrieval missed exact identifiers such as SKUs | | BM25 hybrid RAG | 17/40 | RAG overall remained around $0.13–$0.22 | Keyword retrieval improved both exact matching and overall performance |
Routing also changed CAG economics. On DeepSeek V4.1 Flash, spreading requests across providers caused frequent prompt-cache misses. Keeping the same session ID and routing consecutive requests to one provider made questions about one or two products about three times cheaper. CAG's cache advantage therefore depends not only on the model, but also on route affinity, cache TTL, and prefix stability.
Why RAG and CAG Diverge
RAG: Use Retrieval to Shrink the Context
RAG splits documents into chunks, generates vector representations, encodes the question, retrieves the nearest candidates, and then uses a reranker to select the final evidence. The model-visible context can be approximated as:
Visible context = question tokens + retrieved chunk tokens + output tokens
When the number of retrieved chunks remains fixed, inference cost does not grow linearly with the full corpus. The trade-off is an additional retrieval stack: vector indexing, recall, reranking, data updates, and observability must all be maintained.
Pure vector retrieval is particularly vulnerable with SKUs, model numbers, and error codes. Semantic proximity does not guarantee exact textual matching, and a vector model may tokenize rare identifiers unstably. BM25 supplies lexical matching, while the reranker estimates the actual relevance of each candidate to the question. In this test, adding keyword retrieval improved plain RAG from 9 correct answers to 17.
CAG: Exchange Cache Hits for Full Visibility
CAG places the full document set at the beginning of the prompt in a fixed order and changes only the trailing question:
Prompt = Canonical(Documents) || Question
If tokenization, document ordering, model version, and provider routing remain stable, the provider may reuse prefix prefill computation or KV state and charge a lower cached-input price. This removes vector-recall misses and helped CAG reach 31 correct answers on the product questions.
Prompt caching, however, is neither free long-term memory nor a model-weight update. A simplified cost model is:
CAG cost ≈ cached-input rate × document tokens + normal-input rate × question and output tokens + cache-miss probability × write cost
Even a cache hit may still incur cached-input charges. A route change, modified prefix, model switch, or expired TTL can trigger a full cache write and full-prefix processing. CAG therefore replaces RAG recall errors with context-window, cache-hit, and versioning problems.
Why CAG Still Failed at Catalog-Wide Aggregation
On 12 questions requiring aggregation across the complete catalog, CAG answered only four or five correctly. A system that queried the product database through tools answered all 12. Giving the model access to every document does not automatically give it reliable database-style filtering, exact counting, or structured aggregation.
Long contexts can still suffer from attention dilution, position bias, and interference among competing facts. Prompt caching reuses computation for a repeated prefix; it does not give the model SQL execution, exact counters, or schema-aware aggregation. Full-catalog statistics, inventory reconciliation, and cross-table calculations should query a database or search tool directly.
Engineering Trade-offs
- Recall errors versus context budget: RAG can miss evidence but sends only selected passages. CAG avoids recall misses while keeping the entire corpus in context and exposing the model to positional noise.
- API price versus total cost: RAG has relatively stable inference cost, but embeddings, vector storage, reranking, index updates, and monitoring also cost money. CAG is simpler at the prototype level, yet production use still requires cache-write accounting, TTL management, invalidation, and routing controls.
- Dynamic versus stable corpora: RAG handles frequently changing products, SKUs, and prices more naturally. CAG fits knowledge bases that change infrequently and can preserve a stable prefix.
- Data minimization: RAG normally transmits only retrieved excerpts. CAG sends the full corpus on every request, raising the bar for permission isolation and compliance review.
- Exact identifiers: SKUs, order IDs, and configuration codes should use BM25, field-aware indexes, or structured queries instead of relying on dense similarity alone.
- Provider dependence: CAG economics depend on whether the same provider handles the cached prefix. Production deployments need route affinity, cache-hit monitoring, and failover behavior.
Limits of the Evaluation
The experiment controls catalog size and question count, making scale effects visible, but it remains a limited first-party benchmark:
- The corpus comes from one outdoor-product domain, and 40 questions cannot represent enterprise documents, support dialogues, or multi-hop reasoning.
- The collected material does not disclose chunk size, retrieval count, embedding and reranker models, prompt template, scoring rubric, repeated trials, or confidence intervals.
- The per-1,000-question figures are API price snapshots under particular routing conditions, not complete system cost of ownership.
- OpenRouter operates the model-routing, embedding, and reranking services used here. The results are practically relevant, but independent replication should use identical models, prompts, corpora, and budgets.
- Follow-up testing should include dynamic catalogs, rare SKUs, conflicting versions, adversarial documents, long sessions, global aggregation, and cache-TTL expiry.
Deployment Guidance
- Use hybrid RAG by default: Run vector retrieval and BM25 in parallel, merge their candidates with a reranker, and track semantic recall and exact-match recall separately.
- Keep a tool interface for structured work: Route SKUs, inventory, price ranges, and aggregate counts to SQL or a dedicated search tool instead of asking the model to calculate them from context alone.
- Pilot CAG only for stable, small corpora: Fix document ordering and serialization, enable provider-affinity routing, and monitor hit rate, miss cost, and prefix invalidation.
- Treat CAG as a retrieval alternative, not a complete architecture: If the corpus reaches hundreds of thousands or millions of tokens, changes frequently, or has strict compliance constraints, retain RAG or tool-based retrieval.
- Run controlled A/B tests: Keep the model, questions, scorer, and concurrency fixed while comparing correctness, Recall@k, total cost per 1,000 questions, P95 latency, cache-hit rate, and freshness.
Conclusion
OpenRouter's benchmark shows that CAG can trade cache reuse for higher local QA accuracy, especially over a small and stable corpus. It does not remove context engineering; it shifts cost control toward cache hits and routing stability. For large, dynamic, or calculation-heavy enterprise knowledge systems, BM25 hybrid RAG combined with database tools remains the more robust default.
— END —Source: OpenRouter Blog (2026-12-02)
Tags: #RAG #CAG #Hybrid Retrieval #Prompt Caching #Cost Optimization
Editorial & Fact-Checking Note: This article is compiled from primary research, official release documentation, and source papers by the ZICQ Newsroom pipeline with automated entity verification and human editorial review. If you notice any technical inaccuracy, please submit a correction via our corrections policy or email our editorial desk directly.
Community Comments