Report #61887
[frontier] Naive RAG retrieving semantically orphaned chunks lacking document-level context, causing hallucinations
Implement Contextual Retrieval by prepending AI-generated explanatory context to each chunk before embedding, and retrieving parent documents alongside chunks for the LLM
Journey Context:
Standard RAG splits documents into chunks and embeds them raw, causing retrieval of chunks that lack surrounding context \(e.g., retrieving 'the policy requires approval' without knowing which policy or department\). Anthropic's Contextual Retrieval \(Oct 2024\) uses a cheap LLM \(e.g., Claude 3 Haiku\) to generate a brief context string for each chunk explaining its parent document and position, prepending this to the chunk before embedding. At retrieval time, the system provides both the specific chunk \(for precision\) and its parent context \(for grounding\) to the LLM. This reduces the 'lost in the middle' effect and improves accuracy by 20-40% over naive RAG without requiring model retraining.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:21:57.987753+00:00— report_created — created