esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

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.

11 min readAdvancedOccasional · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

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.

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.

Key words

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.

Search the small piece, answer from the big one

Customer's question

asks about one specific clause

Matching child chunk

a few lines, matched precisely

Parent section

the whole section the child came from

Model

answers from the full section

Answer with a citation

cites section 7.3

  1. 1The question is matched against small child chunks.
  2. 2The matching child links to its bigger parent section.
  3. 3The parent section goes to the model, which reads the conditions.
  4. 4The model answers and names the section it used.
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. 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. 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. 3

    Swap to the parent

    For each child that matched, load its parent. If two children share a parent, send that parent once.

  4. 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

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)

Small chunks only, or parent-child?

Small chunks only

Sentence matched

the exception, with no rule above it

Parent-child

Same sentence matched

then its whole section is read

Model guesses

it misses the rule it needed

Model checks the rule

it reads the condition first

  1. 1The small sentence matches, but nothing above it says which rule applies.
  2. 2The same match brings its parent section, which states the condition.
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.

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."

    BetterBigger 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."

    BetterThen search matches whole sections, which mix topics and rank less precisely.

  • Trap"Parent-child needs a whole new system."

    BetterIt 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?

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?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q113What is chunking, and why does size matter?13 min
  2. Q114Fixed vs recursive vs semantic chunking?12 min
  3. Q115What is chunk overlap?10 min
  4. Q126Rerankers: cross-encoder vs bi-encoder?12 min
  5. Q141What is contextual retrieval?13 min
  6. Q146How do you pick top-k?11 min

Last updated on 27 November 2026

Building an assistant that answers from long documents?

I design and build AI assistants and agents, including the search behind them. Book a short call and tell me what your documents look like.