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
words per indexed chunk
query: "how long is the warranty"
What the model gets
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
- 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.
- 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.
- 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.
- 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.