Retrieval & Vector Search • Sensei Learning System
A chunk keeps its words. It loses everything the document knew about it.
Standard RAG embeds each chunk on its own. The chunk keeps its words and loses everything the document knew about it — the company, the year, the product. Its embedding is therefore a vector for a generic sentence, and it will match a query about any company’s revenue roughly as well as the right one.
“Revenue grew 3% over the previous quarter.” — which company? which quarter? which product? The vector does not know either.Contextual retrieval fixes this at index time, not query time: before embedding, prepend a short generated description of where the chunk sits, then embed the concatenation. The vector now carries the disambiguating context the raw chunk never had.
A chunk embedded alone is a sentence-shaped vector with no address. Identical sentences across documents produce near-identical vectors, so retrieval can’t tell them apart.
A short generated line: “from ACME’s Q2 2024 filing, in the section on segment revenue.” Prepend it to the chunk, then embed the concatenation.
One extra LLM call per chunk at ingest, cached forever. Prompt caching is what makes the cost affordable at all — the fix is paid once, not on every query.
Contextual Embeddings plus Contextual BM25: failed retrievals down 49%. Add a reranking step: 67%. Never quote 49% as embeddings alone.
Numbers as reported by Anthropic for Contextual Retrieval.