Modules/Gen AI/ Parent Document Lab

Parent Document Retriever

Small chunks match precisely and read terribly. Large chunks read well and match vaguely. You do not have to choose: search one and return the other.

Overview

The problem it solves

Chunking forces a trade-off. A small chunk concentrates the query's terms, so its similarity score is high and the match is precise — but on its own it may be a fragment that answers nothing. A large chunk carries the surrounding context that makes an answer possible, but dilutes the matching terms among hundreds of unrelated words, so it scores worse and may not be retrieved at all.

Retrieval

8

words per indexed chunk

query: "how long is the warranty"

What the model gets

Passages
Words

 

1 — The index: child chunks, scored

2 — What is handed to the model

The corpus

Parent Document Retrieval: A Practical Guide

Index the needle, return the haystack it came from.

Searching one thing, returning another

A parent document retriever refuses the trade. It splits each document into small child chunks and indexes only those, so retrieval is as precise as small chunks allow. But when a child chunk wins, what gets passed to the model is the parent it came from. The score decides which document is relevant; the parent decides how much text the model sees. Two chunks from the same parent collapse to one passage, so the context window is not spent sending the same document twice.

Guided experiments

  1. Read the child list at chunk size 8. The winning chunk is a short fragment. Read it alone and ask whether it actually answers the question — it names a duration but not what the duration applies to.
  2. Turn off "Return the parent". The model now receives only those fragments. The word count drops sharply, and so does the chance of a usable answer.
  3. Turn it back on and watch the passage count. Two separate child chunks hit the same document, but only one parent passage is returned — the deduplication is doing real work.
  4. Drag the chunk size up to 24. Each child is now most of its parent. The top score actually goes up — a longer window catches more of the query's words — but the selection gets worse: the second slot now goes to a different product's document, and the model is sent 53 words instead of 29 for the same question.

Summing up

Precision of retrieval and sufficiency of context are different requirements, and chunk size cannot satisfy both at once. Indexing small children while returning their parents lets the score come from the tightest possible match and the context come from the whole document. The cost is a larger prompt, which is why deduplicating parents matters: without it, three good chunks from one document would send that document three times.

Predict, then reveal

About to run: set Child chunk size to its maximum (24). Before it does — what happens to the readout?

Committing to an answer first is the point — the reveal runs the experiment on the visualisation above and reads the real value back, so nothing here is scripted.

Check yourself

0 of 3

Answer without scrolling back up.

  1. In a parent document retriever, what is actually indexed and scored?

  2. Two retrieved child chunks belong to the same parent. How many passages go to the model?

  3. Why not simply index large chunks instead?

Cheat sheet

Parent Document Retriever

Small chunks match precisely and read terribly. Large chunks read well and match vaguely. You do not have to choose: search one and return the other.

GEN AI · vizlearn.in/gen_ai/parent_document_retriever.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.