Parent-Child Chunking
Retrieve small child chunks for precision, then expand to parent sections for generation.
In plain words
Search with tiny snippets so matches are exact, but show the model the bigger section each snippet came from.
Think of it like…
Finding a sentence in a book using a precise index, then reading the whole paragraph or section around it before answering. The index points to the exact spot; the reader gets the context.
Where you’ve seen it
A compliance assistant indexed 400-token chunks and found answers were often incomplete: the matched chunk contained the rule but not the exceptions in the next paragraph. Switching to 150-token children linked to their ~800-token parent sections, retrieval precision stayed the same, while answer completeness (judged on 150 questions) rose from 68 to 84 percent. Prompts grew by about 40 percent in tokens, which they offset by returning four parents instead of eight chunks.
Words you’ll hear
- Child chunk
- Small unit that is embedded and searched.
- Parent chunk
- Larger surrounding unit (section or window) returned to the LLM.
- Deduplication
- Several children from one parent should yield that parent once.
- Auto-merging
- Return the parent only when enough of its children match; otherwise return the children.
Visual diagram
Theory & deep dive
How to build it
At ingestion, split each document into parents using structure (sections or headings; or fixed windows of 600 to 1,500 tokens), then split each parent into children (100 to 250 tokens, optionally with small overlap). Store parents in a key-value or document store by id, and embed only the children, each carrying metadata: parent_id, document id, section path and position. Metadata filters and permissions apply to children and are inherited from the parent.
At query time, retrieve the top k children (k = 10 to 30) with dense, sparse or hybrid search, optionally rerank them, map each child to its parent_id, deduplicate while preserving the best child's rank, and fetch the top parents (3 to 6) within a token budget. Variations: sentence-window retrieval returns the matched sentence plus N neighbours; auto-merging promotes to the parent only when several siblings match; three-level hierarchies (sentence, paragraph, section) allow adaptive expansion.
Top children by score: c12 (parent P3), c13 (P3), c40 (P9), c55 (P3), c61 (P12). After deduplication: P3 (best child c12), P9, P12. Fetch the three parents, about 2,400 tokens, instead of five 150-token fragments with no surroundings.
Trade-offs and tuning
Pros: sharper matching than large chunks, more context than small chunks, no extra model calls, and easy citations (the child span shows exactly where the match was). Cons: larger prompts (cost and latency), possible noise if a parent is mostly irrelevant, more storage (parents and children), and added complexity in ingestion and updates (children and parents must stay consistent when a document changes).
Tune child size by retrieval precision and parent size by answer completeness: if answers miss exceptions or follow-on steps, enlarge parents or return adjacent parents; if prompts are too long or noisy, shrink parents or use auto-merging. Evaluate retrieval (recall@k at child level and parent level) and end-to-end answer quality and citation accuracy on labelled questions. Combine with reranking over parents when you want the LLM to see only the most relevant sections, and with contextual retrieval to make each child self-explanatory.
If at least 3 of a parent's 6 children are in the top 20, return the parent; otherwise return only the matched children plus one neighbour each. This keeps prompts small for narrow questions and rich for broad ones.
How it works, step by step
Step 1 of 41. Choose parent and child boundaries
Use sections as parents and 100–250 token children, with metadata linking child to parent.
- Link
- parent_id on each child
When to use it & trade-offs
What it is
Parent-child chunking (also called small-to-big retrieval) separates what you search from what you send to the LLM. Documents are split into small child chunks (about 100 to 250 tokens) that are embedded and matched precisely, and each child points to a larger parent (a section or a 600 to 1,500-token window). At query time you retrieve the best children, then replace them with their parents (deduplicated) before building the prompt. You get precise matching and rich context at the same time.
Why it matters: Chunk size forces a trade-off: small chunks match queries sharply but leave the LLM without surrounding context; large chunks give context but blur the embedding across several topics. Parent-child retrieval escapes the trade-off, and it's a simple, deterministic change that often raises answer quality without a new model. It's a standard pattern in LangChain (ParentDocumentRetriever) and LlamaIndex (auto-merging retriever).
When to reach for it
- Policies, manuals and contracts where answers span paragraphs
- Systems where precise citations matter
- RAG with answers that need exceptions and follow-on steps
When to avoid or be careful
- Sending every matching child's parent without deduplication
- Parents so large they swamp the prompt
- Updating parents without re-indexing children
Chunk-size strategies
Strengths: Easy; one index.
Watch out: Compromise between precision and context.
Strengths: Precision and context together; clear citations.
Watch out: More storage, bigger prompts, consistency to maintain.
Strengths: Simple; adjustable window.
Watch out: Fixed window ignores document structure.
Interview signals & numbers to know
When this topic comes up
- “The retrieved snippet is right but incomplete”
- “Small chunks match better, large chunks answer better”
- “What is small-to-big retrieval?”
- Auto-merging retrieval
- Sentence-window retrieval
Benchmarks & rules of thumb
- 100 – 250
- child chunk tokens
- 600 – 1,500
- parent chunk tokens
- 68% → 84%
- answer completeness gain in the example
Common mistakes & follow-ups
Common interview mistakes
- Returning five children from the same section as five prompt entries instead of one parent.
- Forgetting to carry ACL metadata from parents to children.
- Changing a document and re-embedding the parent text while leaving old children in the index.
Likely interviewer follow-ups
- How does parent-child retrieval resolve the chunk-size trade-off?
- How do you deduplicate and budget parents?
- When would you use auto-merging?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply Parent-Child Chunking with generative AI interview Q&A and hands-on practice.