Report #30544
[frontier] Chunked document retrieval missing semantic context or retrieving text chunks that lack surrounding context
Implement Contextual Retrieval by embedding chunks with parent document context using Anthropic's approach, storing both the chunk and its contextualized summary in the vector DB.
Journey Context:
Standard RAG splits documents into arbitrary chunks \(e.g., 512 tokens\) and retrieves them. The model receives isolated text like 'the contract shall terminate' without knowing this is from Section 3 of a SaaS agreement, not an employment contract. Anthropic's Contextual Retrieval \(Sept 2024, now production standard in 2025\) prepends each chunk with a contextual summary \('This chunk is from a SaaS contract's termination clause; it discusses...'\) before embedding. This adds ~10-20 tokens overhead per chunk but dramatically improves retrieval accuracy by disambiguating similar-sounding text from different domains. It replaces naive chunking with context-aware embedding that preserves document structure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T05:39:11.667716+00:00— report_created — created