Parent document retrieval indexes small chunks for precision but returns larger parent documents for context. Problem: Small chunks retrieve precisely but lack context; large chunks have context but imprecise retrieval. Solution: Index small chunks (sentences/paragraphs), link each to parent (page/section), retrieve by small chunk but return parent to LLM. Implementation: Store mapping: small_chunk_id → parent_chunk_id. At retrieval: find relevant small chunks → look up parents → return deduplicated parents. Chunk hierarchy: Sentence (retrieval unit) → paragraph → section → document. Can have multiple levels. Trade-offs: Returns more text (larger context windows needed), may include some irrelevant content from parent. LangChain support: ParentDocumentRetriever built-in. Variations: Retrieve then expand (fetch N surrounding chunks), multi-granularity (retrieve at multiple levels). Tuning: Balance child chunk size (precision) vs parent size (context). When to use: When context matters (narratives, technical explanations), when relationships between sentences are important. Widely adopted pattern in production RAG.
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.