What are 'contextual embeddings' and why are they useful?
hardAnswer
- Anthropic's Contextual Retrieval (2024): before embedding a chunk, prepend a short LLM-generated context that situates the chunk within its parent document ('This chunk is from a Q3 2024 earnings report, discussing revenue growth in EMEA').
- Embed the contextualized chunk.
- Solves the 'orphan chunk' problem where standalone chunks lose important framing. 35% retrieval error reduction, up to 67% when combined with reranking.
- Cost: one LLM call per chunk at index time — bearable with prompt caching.
Check yourself — multiple choice
- Same as regular chunks
- Prepend LLM-generated context to each chunk before embedding → solves orphan-chunk problem → 35-67% error reduction
- Only training
- Removes chunking
Contextual Retrieval: LLM-prepended context per chunk → dramatic retrieval accuracy gain.
#rag#retrieval#embeddings
Practise LLMs & GenAI
214 interview questions in this topic.
Related questions
- How does Retrieval-Augmented Generation (RAG) work?
- What are text embeddings and how are they used?
- How should you chunk documents for RAG?
- Walk through the components of a production RAG pipeline.
- What chunking strategies exist beyond fixed-size?
- How do you pick an embedding model for a new RAG project?