firehose> #llmops

Contextual Retrieval

Contextual retrieval fixes a structural failure of naive chunked RAG: when you split a document into chunks and embed each in isolation, a chunk loses the context that made it findable. A paragraph that says "the margin rose to 34%" no longer says whose margin or which quarter, so a query about "ACME Q3 gross margin" may never retrieve it. The corrective is to prepend a short, chunk-situating gloss — generated from the whole document — to each chunk before it is embedded (and before it is indexed for keyword search), so the stored vector and the keyword tokens both carry the document context, not just the isolated span. It is a preprocessing move on the index side, orthogonal to what happens at query time: it composes with Hybrid Retrieval (contextualize the text feeding both the vector and the BM25 channel), Rank Fusion, and a downstream Reranking pass. The trade is index-build cost (one LLM pass per chunk to write its context) against a materially higher retrieval hit-rate.

Anthropic's Claude Cookbooks carry this under capabilities/contextual-embeddings/; the technique is attributed here as the source's recipe, and it slots into the vault's existing retrieval spine rather than replacing any of it.

Claims


Linked from