Anthropic fixes RAG's blind spots with contextual retrieval
Anthropic just introduced Contextual Retrieval, a simple fix for broken RAG systems that lose context after chopping documents into chunks. By prepending chunk-specific context using Claude 3 Haiku, it slashes retrieval failures by 49%, and by 67% when paired with reranking. Prompt caching keeps the preprocessing cost down to $1.02 per million tokens.

Anyone who has built a traditional RAG system knows the frustration of lost context. You chunk a massive financial report into bite-sized pieces, only for your retrieval system to pull a sentence that says revenue grew by 3 percent without mentioning which company or quarter it is talking about.
Anthropic introduced a clean fix called Contextual Retrieval. The core concept is dead simple: before you embed or index a text chunk, you use a fast language model to prepend 50 to 100 tokens of document-level context directly onto that chunk.
Giving every text chunk an ID card
In standard RAG setups, splitting documents into a few hundred tokens destroys situational awareness. Anthropic uses Claude 3 Haiku to read the full source document and write a concise contextual summary tailored to each individual piece.
That anonymous revenue snippet now starts with a clear statement clarifying that it belongs to ACME Corp's Q2 2023 filing. Once the context is baked in, Anthropic creates both semantic vector embeddings and traditional BM25 lexical indices for the enriched text.
Keeping BM25 in the loop is a crucial detail. While embeddings excel at semantic concepts, they frequently stumble on exact technical terms or error codes like TS-999. BM25 catches those literal matches, while embeddings handle the broader meaning.
Across benchmarks spanning codebases, fiction, and scientific papers, Anthropic found that Contextual Embeddings alone cut top-20 retrieval failure rates by 35 percent. Combining Contextual Embeddings with Contextual BM25 dropped failures by 49 percent, and adding a reranker pushed the failure reduction all the way to 67 percent.
Prompt caching makes the math work
Annotating hundreds of thousands of chunks with an LLM used to be a non-starter because passing the full reference document on every API call was way too expensive. Anthropic solved this using their recently released Prompt Caching feature.
Instead of paying full price for the parent document on every single chunk, developers load the document into cache once and reference it repeatedly. Anthropic calculated that for an 8,000-token document split into 800-token chunks, generating contextualized pieces costs just $1.02 per million document tokens.
For smaller knowledge bases under 200,000 tokens (around 500 pages), Anthropic noted you probably do not even need RAG. You can simply cache the entire knowledge base inside the prompt, cutting latency by more than half and reducing costs by up to 90 percent.
Why it matters
For engineers building legal bots, internal search engines, or customer support tools, this is an immediate, actionable upgrade. RAG pipelines usually hit a hard ceiling when document slices lose their subject matter, and spending a single dollar per million tokens on pre-processing to cut retrieval errors in half is a no-brainer.
For the AI landscape, Anthropic is proving that clever data preparation often beats overly convoluted agent architectures. Over the past year, developers have wrestled with complex GraphRAG and recursive chunking pipelines to solve context loss, whereas Anthropic tackled it upstream using a cheap model and an algorithm from the 1990s.
We think this approach is brilliant because it blends brute-force semantic enrichment with the precision of classical search. The catch, however, lies in dynamic datasets: if your knowledge base updates continuously in real time, running model-driven contextualization on every new batch of edits could introduce latency bottlenecks and recurring caching overhead.
Sources (1)
- anthropic.com(opens in a new tab)Originalanthropic.com