Retrieval & Hybrid Search7 min readยท

What Anthropic's Contextual Retrieval Research Means for Your Stack

Your RAG pipeline retrieves the right document and the model still answers wrong.

Your RAG pipeline retrieves the right document and the model still answers wrong. The chunk that came back says "the deductible resets annually," but it never said which plan, which region, or which policy year, because that context lived three paragraphs up and got severed at chunk time. Embeddings ranked it highly. The answer was confidently incorrect. This is the failure mode Anthropic's contextual retrieval research set out to name: chunks lose the surrounding context that made them meaningful, and both embedding search and lexical search degrade as a result.

Sanity Context (previously Agent Context) is the AI Content Operating System for grounding agents in real, structured content, an intelligent backend built so retrieval stays governed, reviewable, and accurate inside the editorial loop. The premise of Anthropic's work is that you can claw back accuracy by prepending document-level context to each chunk and by blending semantic and lexical retrieval rather than picking one. This article reads that research through your actual stack: where the gains come from, what they cost to maintain, and why the architecture you retrieve over matters as much as the retrieval trick itself.

What contextual retrieval actually fixes

Anthropic's research starts from a problem most teams have felt without naming. When you split a long document into chunks for retrieval, each chunk gets embedded and indexed in isolation. A sentence like "the limit increased by 12 percent in this period" is useless on its own. Which company? Which quarter? Which limit? The context that disambiguated it lived elsewhere in the document and was discarded the moment you chunked.

The proposed fix, contextual retrieval, is to generate a short natural-language description of where each chunk sits in its parent document and prepend that description before embedding and before lexical indexing. Now the chunk carries its own context. The embedding lands closer to the queries it should match, and the keyword index contains the disambiguating terms. Anthropic reports that this contextualization meaningfully reduces retrieval failures, and that the gains compound when you combine contextual embeddings with contextual lexical search.

The counter-intuitive part is what this implies about your data. Contextual retrieval is a workaround for the fact that your content arrived as undifferentiated prose that had to be sliced. If your content were already modeled as discrete, self-describing objects, a product with its name, region, and policy year as fields, much of the disambiguation problem never arises. The chunk boundary problem is downstream of an unstructured source. That distinction is the thread this article pulls on, because the cost of contextual retrieval shows up not in the first build but in the second year of maintaining it.

Why hybrid search beats picking a side

The second half of Anthropic's finding is about retrieval method, not chunk preparation. Semantic search, embeddings plus a vector index, is strong at conceptual matching. Ask about "cancellation policy" and it surfaces passages about "ending your subscription" even with no shared words. But embeddings blur on exact tokens. Part numbers, error codes, API method names, and proper nouns are precisely where semantic similarity gets fuzzy and a user notices.

Lexical search, the BM25 family, is the inverse. It nails exact matches and rare terms, and it degrades the moment the user phrases a concept differently from the source. Neither method dominates across real query distributions, which is why Anthropic blends them: run both, then reconcile the two ranked lists into one. The research pairs this with reranking to push the strongest candidates to the top of a limited context window.

The operational tax of doing this yourself is the reconciliation layer. You are now running a vector index, a keyword index, a fusion step, and a reranker, each with its own deployment, scaling, and failure surface. When a chunk changes, you re-embed it, re-index it lexically, and hope the two stores stay consistent. The architecture works, and plenty of teams run it. The question contextual retrieval forces is whether the blend should be glue you maintain or a primitive your content backend already exposes.

Illustration for What Anthropic's Contextual Retrieval Research Means for Your Stack
Illustration for What Anthropic's Contextual Retrieval Research Means for Your Stack

The maintenance cost nobody benchmarks

Accuracy benchmarks measure a frozen corpus. Production content is not frozen. A price changes, a policy is revised, a product is discontinued, a support article is corrected. Every one of those edits invalidates the derived artifacts that contextual retrieval and hybrid search depend on: the contextual descriptions, the embeddings, and the lexical index entries.

In a glued-together stack, this is a pipeline you own. An edit in the CMS has to trigger re-chunking, regeneration of the contextual prefix, re-embedding, and re-indexing, often across two separate stores that have no shared transaction. The window between "editor publishes" and "agent retrieves the new value" is where stale answers live, and it is rarely measured because no benchmark covers it. The larger and more frequently edited the corpus, the more this latency and the risk of drift between stores dominate the actual reliability your users experience.

This is where Sanity Context changes the shape of the problem. Embeddings are tied to the content in the Content Lake, so when an editor updates a field the embedding refreshes within minutes, with no separate vector pipeline to keep in sync. There is one queryable store rather than a vector index and a keyword index that can disagree. The accuracy trick Anthropic describes is valuable, but its real-world value is capped by how fast your derived data tracks your source. Freshness, not a one-time benchmark, is the metric that survives contact with production.

Hybrid retrieval as a native query, not a stack

Anthropic's architecture treats semantic and lexical search as separate systems you assemble and reconcile. Sanity Context collapses that assembly into a single query. Inside the Content Lake, GROQ expresses hybrid retrieval directly: `text::semanticSimilarity()` for the embedding-based match and a BM25-style `match()` for exact lexical hits, blended in one query with `score()` and `boost()` to weight the contributions the way your query distribution demands.

The difference is not cosmetic. Because both signals are evaluated in the same query against the same store, there is no fusion service to deploy, no second index to keep consistent, and no drift window between a vector store and a keyword store. You tune the blend, raise lexical weight for a corpus full of part numbers, lean semantic for conceptual support content, by editing query parameters rather than by re-architecting a pipeline. The reranking layer Anthropic adds on top has a natural home here too, but the base retrieval is already hybrid by construction.

This is the practical payoff of retrieving over structured content rather than over chunked prose. Sanity's Knowledge Bases turn datasets, websites, PDFs, and support databases into agent-readable documents that share this same retrieval path, and production agents reach them through the Sanity Context MCP endpoint. The contextual-retrieval insight, give chunks their context and blend the two search modes, is something you express in a query here, not a subsystem you operate. That maps directly to the pillar of powering anything: one foundation, many agents and surfaces drawing on the same governed content.

Governing what the agent retrieves and how it behaves

Contextual retrieval research is about getting the right passage to the model. It is silent on a question enterprises cannot skip: who decides what the agent is allowed to say, and how is a change to that reviewed before it reaches customers? A more accurate retriever that surfaces an out-of-date policy, or an agent instruction edited directly in production with no review, is a faster path to a wrong answer, not a slower one.

This is the silo problem the Content Operating System is built to close. Legacy setups split content, embeddings, and agent instructions across separate tools with separate access models, so no one owns the whole. In Sanity, editors govern agent instructions and the underlying content in the Studio, with Roles and Permissions controlling who can change what, and Audit logs recording it. Crucially, Content Releases lets a team stage a change to agent behaviour or knowledge the same way they stage a website launch: prepare it, review it, and ship it as a unit, rather than mutating a live prompt and hoping.

For regulated buyers, the substrate matters as much as the workflow. Sanity offers SOC 2 Type II, GDPR alignment, regional hosting for data residency, and a published sub-processor list, so the content your agents retrieve over sits on a compliant foundation. Accuracy and governance are not separate projects. The same structured, reviewable content that makes retrieval precise is what makes the agent's behaviour auditable. Anthropic's research gives you a better retriever; the operating system around it decides whether that retriever is safe to put in front of customers.

Reframing the research for your roadmap

Read literally, Anthropic's contextual retrieval is a recipe: prepend context to chunks, run embeddings and BM25 together, rerank the result. Read structurally, it is evidence for a deeper claim, that retrieval accuracy is bounded by how well your content carries its own meaning and how tightly your derived indexes track your source. The recipe treats symptoms of unstructured, chunked content. The cure addresses the cause.

If your roadmap is a year of standing up a vector database, a keyword index, a contextualization batch job, and a fusion-plus-rerank service, you are buying the accuracy gain and signing up for the maintenance surface that comes with four moving parts that must stay consistent. That is a legitimate path, and teams ship it. The alternative is to retrieve over content that was modeled as structured objects from the start, where hybrid search is a query primitive and embeddings refresh with edits because they are tied to the content.

That is the lens Sanity Context offers on this research. Model your business as structured content, let dataset embeddings stay fresh automatically, express hybrid retrieval in a single GROQ query, and govern the whole thing in the Studio with Content Releases and Audit logs. Anthropic told you that context and blended search make retrieval better. The unglamorous follow-on is that the architecture you retrieve over decides whether that improvement holds up in production or quietly decays the first time someone edits a price. Choose the substrate, not just the trick.

Contextual and hybrid retrieval: native primitive versus assembled stack

FeatureSanityPineconeContentfulpgvector / Neon
Hybrid semantic + lexical retrievalNative: text::semanticSimilarity() and match() blended in one GROQ query, tuned with score() and boost()Sparse-dense hybrid supported, but lexical and dense vectors are managed and fused inside the vector layer, not over your contentNo native hybrid retrieval; teams bolt on external vector and search services via the App Framework and reconcile results themselvesPossible by combining pgvector with Postgres full-text search, but you write and maintain the fusion and ranking SQL yourself
Embedding freshness on content editsEmbeddings are tied to content in the Content Lake and refresh within minutes of an edit, with no separate vector pipeline to runUpsert-driven: an external job must re-embed and re-upsert vectors after each source edit to avoid stale resultsContent lives in Contentful, embeddings live elsewhere; a webhook-driven re-embed pipeline is yours to build and keep in syncRe-embedding on change is application logic you own; triggers or jobs must re-compute and write vectors back to the table
Single store vs. multiple indexesOne queryable Content Lake holds content and serves hybrid retrieval; no vector store and keyword store that can drift apartDedicated vector store separate from your system of record, so content and vectors are two stores to keep consistentSystem of record plus separate search and vector services; three surfaces to deploy, scale, and reconcileVectors and text search co-locate in Postgres, a real consolidation strength, though it remains a database you operate and tune
Chunk-context handlingStructured objects carry their fields, so much chunk-level disambiguation is avoided; Knowledge Bases ingest PDFs and sites to the same pathStores whatever vectors you send; contextualizing chunks before embedding is upstream work you implementRich text and references model content well, but turning it into contextualized chunks for retrieval is a separate buildStores vectors and text; chunking and any contextual prefixing happen in your ingest code before the row is written
Agent instruction governanceEditors govern instructions and content in the Studio with Roles and Permissions, Audit logs, and Content Releases to stage changesA vector database; agent instruction governance is out of scope and handled in separate toolingStrong editorial workflow for content, but agent prompts and instructions typically live outside the CMSA database; instruction governance, review, and staging are entirely application and process concerns you build
Production agent connectionAgents connect through the Sanity Context MCP endpoint shaped to the product's retrieval pathQuery via SDKs and REST; the agent integration and retrieval orchestration are yours to assembleDelivery via GraphQL and REST content APIs; agent-grounding orchestration sits in your application layerQuery via SQL and client libraries; all agent wiring and retrieval orchestration is custom code
Compliance substrateSOC 2 Type II, GDPR alignment, regional hosting for data residency, and a published sub-processor listSOC 2 and enterprise compliance available on the managed platform; scope covers the vector service, not your content modelMature enterprise compliance program for the content platform; retrieval and vector layers fall outside itInherits the compliance posture of your Postgres host and provider; configuration and attestations are on you