Parent-Child Retrieval

Small chunks retrieve precisely but lack context; large chunks have context but retrieve poorly. Parent-child retrieval (also called small-to-big) gets both: it searches over small child chunks for precise matches, then returns the larger parent chunk for full context. It's one of the most effective fixes for the chunking trade-off you met earlier.

💡 In one line: Parent-child retrieval matches small child chunks for precision but returns their larger parent for context.

The Problem It Solves

Recall the chunking dilemma:

  • Small chunks → precise retrieval, but the answer's surrounding context is missing.
  • Large chunks → rich context, but imprecise, noisy retrieval.

Parent-child breaks the trade-off by retrieving small and returning large.

What is Parent-Child Retrieval?

You split each document two ways: into large parent chunks, and each parent into small child chunks (every child linked to its parent). Then you embed and search the children, but return the parent to the LLM.

How It Works

Whiteboard
Whiteboard diagram

Why It Works

Children are specific, so they produce strong, precise matches against the query. Parents carry the surrounding context, so the LLM sees the full picture instead of an isolated fragment. You get the precision of small chunks and the context of large ones.

Variants

  • Small-to-big — child chunks link to the full parent document.
  • Sentence-window — retrieve a sentence, then return a window of surrounding sentences.
  • Auto-merging — when several children of the same parent match, merge them back into the parent.

Trade-offs

  • Parents can be large → more tokens, and some irrelevant text.
  • You must store parent-child links and deduplicate parents (several children may share one).
  • Cap parent size, and consider reranking the returned parents.

Implementation

Frameworks provide this out of the box — for example, LangChain's ParentDocumentRetriever and LlamaIndex's auto-merging and sentence-window retrievers.

Best Practices

  • Tune child and parent sizes to your content.
  • Deduplicate parents and cap their size.
  • Combine with reranking and metadata filters.

Summary

  • Parent-child retrieval searches small child chunks but returns their larger parent.
  • It resolves the precision vs. context trade-off of chunking.
  • Variants include small-to-big, sentence-window, and auto-merging.
  • Watch token cost and deduplicate shared parents.
  • It's built into LangChain and LlamaIndex, and pairs well with reranking. EOF echo created