# What Is Parent-Child (Small-to-Big) Retrieval?

> How small chunks find the exact passage and bigger parent sections give the model the context to answer, explained for your AI interview.

**In short:** Parent-child retrieval searches small chunks for a precise match, then sends the bigger parent section those chunks belong to. The small piece finds the right place, and the parent gives the model the conditions it needs to answer.

AI and LLM interview question Q142, Retrieval-augmented generation (RAG). Advanced, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-is-parent-child-small-to-big-retrieval

## Say it in 30 seconds

Parent-child retrieval splits each document twice. The small child chunks are what the search matches, because a short piece matches a precise question well. Each child links to its bigger parent section, and that parent goes to the model, so the answer has the full context. The costs are more storage and more text per answer, and a long parent can bury the key line, so I keep parents to one section and test them.

## Say it in 2 minutes

Search tends to work better with small pieces. A short paragraph matches a question more precisely than a whole manual, because it is about one thing. But a short piece often lacks the context the model needs to answer well. Parent-child retrieval solves that with two sizes. Each document is cut into small child chunks, and each child keeps a link to its parent, a bigger section that contains it.

At query time, the system searches the children and finds the exact sentence. Then it follows the link and sends the parent section to the model. In a claims assistant, a child might say that a flood exclusion does not apply after a burst pipe. The parent shows which exclusion it is, and the conditions around it.

The trade-off is real. Bigger parents cost more text per answer, take more storage, and can bury the key line. Research on long inputs found that performance can degrade when relevant information moves into the middle. So I keep parents to one section, send each shared parent only once, and test with real questions from the desk.

LlamaIndex has a version of this called the auto-merging retriever. It looks at the small pieces that matched and merges them into their parent once enough of them point to the same one. The idea is the same: search small, answer from the bigger piece.

## What is parent-child retrieval, in plain words?

Search tends to work better with small pieces. A short paragraph matches a question more precisely than a whole 40-page manual, because it is about one thing. The catch is that a short piece often lacks the context the model needs to answer well.

Parent-child retrieval uses two sizes. You cut each document into small child chunks and index those for search. Each child keeps a link to its parent, a bigger section that contains it. When a child matches, the system sends the parent to the model instead of the child.

Think of an insurer's claims desk. An adjuster scans a short note in the index, then pulls the whole policy section from the file, because the note alone doesn't say which condition applies. A claims assistant built this way works the same: the index does the search, and the section gives the answer its context.

- **Chunk:** A piece of a document, cut out so it can be searched and sent to the model.
- **Child chunk:** A small piece that is indexed for search and matches the question.
- **Parent chunk:** A bigger section that holds a child. The model reads this one.
- **Vector index:** The store that finds chunks by meaning, not only by matching words.

## How does the lookup work, step by step?

Take a made-up insurer with a 90-page policy manual. A customer asks: "Does flood cover a burst pipe inside the home?" The search finds one child chunk. Alone, it is one sentence. With its parent, it is the rule.

*Diagram, Search the small piece, answer from the big one: A question finds one small child chunk. The system follows its link to the parent section and sends that to the model, which answers and cites the section. Each step uses the size that suits it.*
1. The question is matched against small child chunks.
2. The matching child links to its bigger parent section.
3. The parent section goes to the model, which reads the conditions.
4. The model answers and names the section it used.

1. **Cut twice:** Split each document into parent sections, then split each section into child chunks. Store a link from every child to its parent.
2. **Search the children:** Turn the question into a vector (a list of numbers that stands for the meaning of a text), then find the closest children in the vector index.
3. **Swap to the parent:** For each child that matched, load its parent. If two children share a parent, send that parent once.
4. **Answer from the parent:** The model reads the parent sections and answers. The answer can name the section, so a person can check it.

Here is a tiny version in plain Python. Keyword overlap stands in for the vector search, so the idea shows without any model.

```python
# A simplified claims-policy search: children are searched, parents are returned.
PARENTS = {
    "7.3": "Flood damage is excluded. This exclusion does not apply if a burst pipe inside the home caused the water.",
    "7.4": "Subsidence is excluded unless it follows a leak from a home pipe, which section 7.3 covers.",
}
CHILDREN = [
    ("Flood damage is excluded.", "7.3"),
    ("This exclusion does not apply if a burst pipe inside the home caused the water.", "7.3"),
    ("Subsidence is excluded unless it follows a leak from a home pipe.", "7.4"),
]

def words(text):
    return set(text.lower().replace(".", "").replace(",", "").replace("?", "").split())

def search(question, k=3):
    q = words(question)
    ranked = sorted(CHILDREN, key=lambda c: len(q & words(c[0])), reverse=True)
    parents = []
    for child, pid in ranked[:k]:
        print("Child matched: " + child)
        if pid not in parents:
            parents.append(pid)
    return parents

question = "Does flood cover a burst pipe inside the home?"
for pid in search(question):
    print("Send to model, section " + pid + ": " + PARENTS[pid])
```

Output:

```text
Child matched: This exclusion does not apply if a burst pipe inside the home caused the water.
Child matched: Subsidence is excluded unless it follows a leak from a home pipe.
Child matched: Flood damage is excluded.
Send to model, section 7.3: Flood damage is excluded. This exclusion does not apply if a burst pipe inside the home caused the water.
Send to model, section 7.4: Subsidence is excluded unless it follows a leak from a home pipe, which section 7.3 covers.
```

## Why search small but answer from big?

Searching and answering want different things. Searching wants one topic per piece. Answering wants the conditions and exceptions around it.

- **Small chunk: Finds well.** One topic per piece, so the search ranks it high for a precise question.
- **Small chunk: Answers poorly.** Without its section, it can lose the condition that makes it true.
- **Parent section: Searches poorly.** It has the conditions, but it mixes topics, so it matches less precisely.

Two sources back parts of this. LlamaIndex's own guide describes the lookup, and a 2023 study found that fine-grained units retrieve better than passages.

> "During query-time, we retrieve smaller chunks, but we follow references to bigger chunks." (LlamaIndex, recursive retriever guide)
>
> "Our experiments reveal that indexing a corpus by fine-grained units such as propositions significantly outperforms passage-level units in retrieval tasks." (Chen et al., Dense X Retrieval (arXiv, 2023))

*Diagram, Small chunks only, or parent-child?: Both paths find the same small sentence. Only the parent-child path sends the section that states the rule, so the model can answer the condition instead of guessing it.*
1. The small sentence matches, but nothing above it says which rule applies.
2. The same match brings its parent section, which states the condition.

## What are the trade-offs and variants?

Parent-child suits documents with long sections, but it has costs you should name.

- **Storage:** In LlamaIndex's example, the vector index holds only the smallest pieces, the child chunks. The parents sit in a separate store, and each child keeps a pointer to its parent.
- **Cost per answer:** A parent is more text, so each answer costs more to generate.
- **Buried answers:** A long parent can hide the key line in its middle, where a model may miss it.
- **Shared parents:** Several children can point to one parent, so remove the repeats before you send.
- **Variants:** LlamaIndex's auto-merging retriever merges matching leaf nodes (the small pieces that were indexed) into their parent once enough of them match. Its recursive retriever follows references from small chunks to bigger ones.

The buried-answer risk has a research basis. A 2023 study of long inputs found that where the relevant line sits matters.

> "We find that performance can degrade significantly when changing the position of relevant information" (Liu et al., Lost in the Middle (arXiv, 2023))

> **Tip:** Asked how to size a parent? Say you test it: keep parents to one section, measure answers on real questions, then adjust. Don't claim one size works everywhere.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: search small pieces, then answer from the parent section they belong to.
- [ ] Why two sizes: precise matching, and enough context to answer.
- [ ] Where the link lives, and how you send a shared parent only once.
- [ ] The costs: storage, text per answer, and the buried-answer risk.
- [ ] A named variant, such as LlamaIndex's auto-merging retriever.
- [ ] How you would test it, with real questions from the claims desk.

**Common traps**

- Trap: "Bigger chunks are always better for answers." Better: Bigger chunks give the model more context, but they match questions less precisely and can bury the key line. Two sizes keep both.
- Trap: "Just index the parent sections." Better: Then search matches whole sections, which mix topics and rank less precisely.
- Trap: "Parent-child needs a whole new system." Better: It adds a link from each child to its parent and a second store for the parents. The model call itself stays the same.

## Can you spot the right setup?

**Spot the setup:** A claims assistant must answer policy conditions precisely. Which index setup fits?

A. Index the 14-page parent sections only, and search those.
B. Index one-sentence child chunks, each storing its parent ID, and send the parent to the model.
C. Index the full policy manual as one chunk, and send it to the model.
D. Index child chunks with no parent link, and send the top child alone.

**Answer:** B. Small children match a precise question, and the stored parent ID brings back the conditions. Whole sections match loosely, and a child sent alone loses its rule.

**Quick check:** A customer asks about one exception. The right child is found, but the model still guesses the rule. What is the likeliest fix?

A. Use a bigger model
B. Send the child's parent section, not the child alone
C. Ask the customer to repeat the question
D. Split the policy into even smaller chunks

**Answer:** B. The child holds the exception but not the rule around it. The parent section carries that context. A bigger model, a repeated question or smaller chunks don't bring back the missing rule.

## Can you answer these from memory?

**Flash cards**

- **What is parent-child retrieval?** Search small child chunks, then send the bigger parent section each one belongs to.
- **Why index small chunks?** A small piece matches a precise question more sharply than a long one.
- **Why send the parent?** The parent holds the conditions and exceptions that the small piece may lack.
- **What is the main cost?** More storage and more text per answer. A long parent can bury the key line.
- **What about shared parents?** Remove the repeats: send each parent once, even if several children matched.
- **LlamaIndex's version?** The auto-merging retriever merges matching leaf nodes into their parent once enough match.

## Likely follow-up questions

- Q113 What is chunking, and why does size matter? https://designervenkat.online/interview/ai/what-is-chunking-in-rag
- Q114 Fixed vs recursive vs semantic chunking? https://designervenkat.online/interview/ai/fixed-vs-recursive-vs-semantic-chunking
- Q115 What is chunk overlap? https://designervenkat.online/interview/ai/what-is-chunk-overlap
- Q126 Rerankers: cross-encoder vs bi-encoder? https://designervenkat.online/interview/ai/cross-encoder-vs-bi-encoder-rerankers
- Q141 What is contextual retrieval? https://designervenkat.online/interview/ai/what-is-contextual-retrieval
- Q146 How do you pick top-k? https://designervenkat.online/interview/ai/how-do-you-pick-top-k
