Generate Contextual Embeddings for RAG Chunks
Use an AI model to create concise, chunk-specific context for RAG.
For a financial document chunk like 'The company's revenue grew by 3% over the previous quarter.', the generated context might be 'ACME Corp Q2 2023 revenue growth details.' This prepended text is then embedded with the original chunk.
Prepend concise, chunk-specific context to each chunk before embedding it for RAG. This context should explain the chunk using the context of the overall document.
When dealing with large knowledge bases where traditional RAG struggles with context loss in smaller chunks.
Overly generic context, context that is too long and exceeds token limits, or context that misinterprets the chunk's meaning.
This pattern involves using an AI model to generate explanatory context for individual data chunks before they are embedded. This prepended context helps maintain the chunk's meaning and relevance within a larger knowledge base for RAG systems.
It solves the problem of context loss in traditional RAG by ensuring each chunk has sufficient explanatory information, allowing for more accurate retrieval even when chunks are small or lack explicit identifiers.
When the knowledge base is small enough to fit entirely within the model's context window, or when exact lexical matches are the only retrieval criteria needed.
- Contextual Retrieval in AI Systems ↗Anthropic Engineering · Anthropic Engineering · Jan 7, 2026 · paraphrased
First seen on Subvolts Jan 7, 2026. Updated Sep 11, 2026. Spotted a problem? Tell us.
- Contextual Retrieval in AI SystemsAnthropic · Anthropic Engineering · Jan 7, 2026
The Playbook: reusable how-tos, prompts, configs and tips pulled out of the news.
- Case studyUsing LLMs to build tools for iOS location data analysisResearchers used an LLM to build a tool that decoded iOS location data, overcoming LLM analysis limitations. · 60 min
- ToolExtractor tool to recover protobuf schemas from Apple binariesPython tool to reliably recover protobuf schemas from Apple binaries for analysis. · 30 min
- TemplatePrompt Library for Life Sciences TasksA collection of pre-written prompts designed for optimal results on common life sciences tasks. · 2 min
- ChecklistEvaluating LLM N-day exploit generationSteps to assess an LLM's ability to turn security patches into proof-of-concept crashes. · 30 min
- Troubleshooting fixImprove RAG retrieval accuracy with Contextual RetrievalReduce failed retrievals by adding context to RAG chunks. · 45 min
- Case studyUsing Screwtape to find confirmed failures of AI monitorsDemonstrates how a red-teamer can find confirmed failures of an AI monitor without developer infrastructure access. · 120 min
Questions people ask
- Which AI tools does this work with?
- Any current model. It was seen with Claude in the sources.
- Where did this come from?
- Anthropic Engineering (Anthropic Engineering). Subvolts collected, normalized and credited it; the link above opens the original.

