RAG vs CAG: We Measured Accuracy and Cost at 3 Sizes
If you are building a chatbot or search tool that answers questions from your own documents, you have two main ways to give the model those documents. Retrieval-augmented generation (RAG) searches your documents for each question and sends the model only the few pieces that look relevant. Cache-augmented generation (CAG) sends the model all of your documents with every question and uses prompt caching to keep that affordable. That is the choice in RAG vs CAG. To compare them, we built a product catalog for an online outdoor store and asked the same 40 questions at three catalog sizes, about 9K, 66K and 330K tokens. We ran everything through the OpenRouter API on November 8, 2026. CAG answered more questions correctly at every catalog size. RAG cost much less once the catalog got large, and CAG's cost on DeepSeek V4.1 Flash depended on how requests were routed. ## Tl;dr - On the largest catalog (3,000 products), CAG answered 31 of 40 questions correctly on GPT-6 Luna. Plain RAG, which uses embeddings only, answered 9, and hybrid RAG, which adds keyword search, answered 17. - Plain RAG could not find products by their product code (SKU) in the largest catalog. Keyword search fixed that. - RAG cost about the same at every size, $0.13 to $0.22 per 1,000 questions. On GPT-6 Luna, CAG cost rose from $0.13 to $8.70 per 1,000 questions as the catalog grew. - On DeepSeek V4.1 Flash, CAG requests were spread across many providers, so the cache often missed. Sending the same session ID with every request kept them on one provider, and questions about one or two products cost about 3x less. - Neither RAG nor CAG counted reliably across the whole catalog. CAG answered 4 or 5 of the 12 whole-catalog questions on the large catalog. A model that could query the catalog with tools answered every question. ## What is the difference between RAG and CAG? RAG sends the model a few relevant pieces of your documents. CAG sends all of them every time and relies on caching to keep the repeated part cheap. In RAG, you first split your documents into chunks and turn each chunk into an embedding with our embeddings API. An embedding is a list of numbers that captures what a piece of text is about, so two texts on the same topic get similar numbers. When a question comes in, you turn it into an embedding too and pick the chunks whose numbers are closest. A reranker, a second model that scores each chunk against the question, then keeps the best few. Our rerank API handles that step. Plain RAG uses only embeddings. Hybrid RAG also uses keyword search, which finds chunks that contain the exact words in the question. The usual keyword method is BM25, a standard way to rank text by the words it shares with the question. In CAG, you put all your documents at the start of the prompt, in the same order on every request. The provider stores that repeated start in its prompt cache, so later requests pay a lower price for it. The benefits are that you build no retrieval step and the model sees every document. The table sums up the differences. | | RAG | CAG | | --- | --- | --- | | What the model sees | A few chunks picked for each question | All of your documents | | What you build | An index of embeddings and a retrieval step | Nothing beyond the prompt | | Cost per question | About the same however many documents you have | Grows with the size of your documents | | Works best for | Large or changing document sets | Small document sets that rarely change |