Skip to content
BENIBIX Learn

Contextual Retrieval

Also known as Contextual Embeddings, Contextual Chunk Headers, Contextual BM25

Each chunk gets a short note that says where it came from.

Think of it like

It is like writing the book name on each torn page. Each page still makes sense.

Example

Anthropic tested it in 2024. Adding notes cut failed searches by 49%, and by 67% with reranking on top.

Why it matters

Chunks lose their context when cut out. This puts the context back, so fewer facts get lost.

Definition

Contextual retrieval adds a short note to each chunk before it is indexed. A model reads the whole document and writes one or two lines saying where the chunk fits. A chunk that says "sales grew 3%" becomes "From Acme's 2023 report: sales grew 3%". The note goes into both the embedding and the keyword index. Chunks that made no sense alone can now be found.
The same chunk, with and without its note. Only the second one can be found.

Common mistake

Forgetting the cost. A model has to read the document once per chunk, though prompt caching helps.

Key takeaways

  1. 1
    Note each chunk. Where it fits in the document.
  2. 2
    Before indexing. Into vectors and keywords both.
  3. 3
    Fewer misses. Lonely chunks become findable.