protologue

Contextual Retrieval

Also called contextual embeddings, contextual BM25, chunk contextualization.

Contextual retrieval is a RAG preprocessing technique in which a language model writes a short explanation of where each chunk fits in its source document and prepends it to the chunk before the chunk is embedded and indexed for keyword search.

Description

Splitting removes context, so a chunk such as "revenue grew 3% over the previous quarter" no longer says which company or quarter it describes. Adding that context back improves both embedding and BM25 matching. Anthropic reported that contextual embeddings plus contextual BM25 cut the top-20 retrieval failure rate by 49% on its benchmarks, and by 67% with reranking added. Prompt caching keeps the cost of generating the context for every chunk low.

Sources

  1. Anthropic (2024). Introducing Contextual Retrieval.

Cite this entry

Protologue. (2026). Contextual Retrieval. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.4.0, PTL-0132). https://protologue.com/t/contextual-retrieval/

BibTeX
@misc{protologue_contextual_retrieval,
  title = {Contextual Retrieval},
  author = {{Protologue}},
  year = {2026},
  howpublished = {Protologue: A Taxonomy of Prompting and LLM Techniques, v1.4.0},
  note = {Entry PTL-0132},
  url = {https://protologue.com/t/contextual-retrieval/}
}

Markdown JSON