Learn/LangChain Mastery/Part 6 · 5. Retrieval & RAG Patterns
Lesson 43 of 68
SyllabusLangChain Mastery · Part 6

Parent Document Retrieval

Embed small chunks. Retrieve big context.

Course outline & contents
LangChain Mastery
The Retriever InterfaceSimilarity vs MMRMulti-Query RetrievalRAG-FusionQuery DecompositionParent Document RetrievalContextual CompressionPost-Retrieval Re-RankingConversational RAG & History

Small Chunks: Great for similarity search. They are dense and specific. Big Chunks: Great for LLM comprehension. They provide continuity and background.

If you embed big chunks, you lose search precision. If you return small chunks, the LLM loses context.

Parent Document Retrieval separates "What we search" from "What we deliver."

  1. Split: Take a large document (Parent). Split it into 10 small pieces (Children).
  2. Index: Embed the Children.
  3. Store: Store the Parent in a key-value store (using doc ID).
  4. Retrieve:
    • Search matches Child #4.
    • Look up Parent ID of Child #4.
    • Return the Parent to the LLM.

The retrieval signal is laser-focused (Child), but the context window is rich (Parent). This is excellent for Q&A on technical manuals where the answer depends on the surrounding paragraphs.

Don't force the embedding model and the generation model to see the same text. Optimize one for math (embeddings) and one for reading (generation).

Key Intuition: "Search for the needle, return the haystack."

Track your progressSign in and your progress follows you across devices.
Sign in to track progress Next lesson
← Previous lessonQuery DecompositionNext lesson →Contextual Compression