RAGEngineering Hub
Chapter 4 · concept 5 of 6 · show all
  1. 1What RAG is, and why
    1. 1.1Why models need outside knowledge, and what hallucination means
    2. 1.2What RAG is: anatomy of a request
    3. 1.3RAG vs fine tuning vs long context and prompt caching
    4. 1.4Use cases and the quality, latency and cost triangle
    5. Chapter overview
  2. 2Tokens, cost and your first RAG
    1. 2.1Tokens and context windows for RAG
    2. 2.2The RAG lifecycle and your first RAG in miniature
    3. Chapter overview
  3. 3Getting documents in
    1. 3.1Content sources and file formats
    2. 3.2Parsing, layout and OCR
    3. 3.3Tables, images and mixed content
    4. 3.4Cleaning, normalization and quality gates
    5. 3.5Metadata, document identity and versioning
    6. 3.6Updates, deletes, reindexing and ingestion pipelines
    7. Chapter overview
  4. 4Chunking
    1. 4.1Why we chunk, and the main chunking strategies
    2. 4.2Structure aware chunking and tables
    3. 4.3Chunk size, overlap and token based sizing
    4. 4.4Contextual chunking and late chunking
    5. 4.5Parent child and multi representation indexing
    6. 4.6Chunk metadata, provenance and the chunking debugging playbook
    7. Chapter overview
  5. 5Embeddings
    1. 5.1Embeddings and similarity from first principles
    2. 5.2What embeddings cannot do
    3. 5.3Choosing an embedding model: size, cost, language
    4. 5.4Embedding model migration and index rebuilds
    5. Chapter overview
  6. 6Vector stores and scores
    1. 6.1Vector databases, ANN indexes and choosing a store
    2. 6.2Score calibration and thresholds
    3. 6.3Late interaction and multivector retrieval
    4. Chapter overview
  7. 7Finding the right chunks
    1. 7.1Query understanding, rewriting and expansion
    2. 7.2Dense retrieval and keyword search with BM25
    3. 7.3Hybrid retrieval and rank fusion
    4. 7.4topK, no good match, and metadata filtering
    5. 7.5Routing, diversity, deduplication and caching
    6. 7.6Reranking: two stage, cross encoder and LLM rerankers
    7. Chapter overview
  8. 8When retrieval fails
    1. 8.1Retrieval failure analysis playbook
    2. Chapter overview
  9. 9Building the answer
    1. 9.1Context selection, packing and citations
    2. 9.2Grounding prompts and abstention
    3. 9.3Lost in the middle and context management
    4. 9.4Conflicts, staleness and freshness rules
    5. 9.5Hallucination checks and answer verification
    6. 9.6Conversational RAG, answer UX and RAG APIs
    7. Chapter overview
  10. 10Measuring
    1. 10.1Why measure, and what to measure
    2. 10.2Building a golden dataset
    3. 10.3Retrieval metrics: precision, recall, MRR, nDCG
    4. 10.4Faithfulness and answer correctness
    5. 10.5LLM as judge, and judging the judge
    6. 10.6Offline and online evals, regression tests and slices
    7. Chapter overview
  11. 11Safety and operations
    1. 11.1Prompt injection and poisoned documents
    2. 11.2Access control, privacy and governance
    3. 11.3Index lifecycle operations
    4. 11.4Observability and tracing
    5. 11.5Latency, cost, caching and model routing
    6. 11.6Reliability, degraded modes and launch readiness
    7. Chapter overview
  12. 12Scale and advanced RAG
    1. 12.1Scaling, multi tenancy and enterprise architecture
    2. 12.2Choosing an architecture: naive, advanced, agentic, graph
    3. 12.3Agentic RAG and RAG as an MCP tool
    4. 12.4GraphRAG, structured data and multimodal RAG
    5. Chapter overview

Parent child and multi representation indexing

Search with small precise pieces, answer with the larger section they belong to, and other ways to index one passage in more than one form.

A real question

Small chunks are found easily but carry too little. Large chunks carry context but are hard to find. Do I have to choose?

No. Search with small pieces, and give the model the whole section each piece belongs to.

The problem

Why this matters

You pick one chunk size and live with its trade-off.
The belief

You pick one chunk size and live with its trade-off.

Parent child indexing uses two sizes: small children for search, their parent section for the answer. Same recall as 512 token chunks here, with half the prompt.
What really happens

Parent child indexing uses two sizes: small children for search, their parent section for the answer. Same recall as 512 token chunks here, with half the prompt.

Why not the simpler way

Chunk size forces a trade. Small chunks match a question precisely but carry little context, so the answer can be half there. Large chunks carry context but match loosely and fill the prompt. The simple approach picks one size and accepts the loss. Parent child indexing refuses the trade: it searches with one size and answers with another.

The idea

The idea in plain words

Split each section (the parent) into small pieces (the children). Embed and search only the children. When a child matches, return its parent to the model. More generally, multi representation indexing stores several forms of the same passage for search, such as a summary, likely questions it answers, or a table rendered as sentences, and maps each back to the original passage.

A library index card lists one keyword, but points you to the whole chapter.

How it works

Step by step

  1. Sections are the parents. Each one is cut into small children, and every child remembers its parent.
    1

    Split each section into children

    Sections are the parents. Each one is cut into small children, and every child remembers its parent.

  2. Small pieces match a question precisely.
    2

    Search only the children

    Small pieces match a question precisely.

  3. For each matching child, the model gets the full section, so the answer has its context.
    3

    Send the parent

    For each matching child, the model gets the full section, so the answer has its context.

In detail

  1. Chunk by structure to get parents (here: sections up to 1,024 tokens).
  2. Split each parent into children (here: recursive 128 tokens), and keep the parent id on each child.
  3. At query time, rank children, walk down the list, and collect distinct parents until you have k.
  4. Put the parents, not the children, into the prompt.

The order matters. Our first attempt made children with a separate chunker over the whole document; some crossed a section boundary, mapped to a parent that held only part of the answer, and recall dropped to 26 of 47. Splitting children from inside each parent fixed it.

The code

Try it in Python

def build(parents, split_child, embed):
    children = []
    for pid, parent in enumerate(parents):
        for text in split_child(parent):        # children come from inside the parent
            children.append({"pid": pid, "text": text, "vec": embed(text)})
    return children

def retrieve(q_vec, children, parents, k=3):
    ranked = sorted(children, key=lambda c: -(c["vec"] @ q_vec))
    picked = []
    for c in ranked:
        if c["pid"] not in picked:
            picked.append(c["pid"])
        if len(picked) == k:
            break
    return [parents[p] for p in picked]

See it

What we measured

Measured · evidence recall@3 and context tokens per question

Polder corpus, 47 golden questions, bge-small-en-v1.5. Parents: sections up to 1,024 tokens (91). Children: recursive 128 inside each parent (125). Context tokens: median of the 3 units sent to the model.

Recursive 512 chunks, median 817 tokensbaseline0.936 (44 of 47)
Children only, top 30.9360.894 (42 of 47)
Children searched, parents returned, median 404 tokens0.9360.936 (44 of 47)

Measured 2026-11-03 with fresh embeddings; the recursive 512 row re-measured 2026-11-04 with corpus/scripts/measure-part-3.mts. Same recall as recursive 512 with 51% fewer context tokens. Multi representation variants were not measured.

Try it on a real example

47 test questions, three ways to fill the prompt

Send

Measured on the Polder corpus

Answer passage in the top 3: 44 of 47 · context per question: median 817 tokens

Good recall, large prompts.

Choosing

Use it when, avoid it when

Use it when
  • Documents with clear sections and questions that need the surrounding text
  • When the prompt budget is tight but recall must stay
Avoid it when
  • Children made by a separate chunker over the whole document
  • Unbounded parents: very long sections fill the prompt

What it costs · Two stores instead of one, and more vectors: 125 children here against 34 chunks for recursive 512. In return, less than half the prompt tokens per question.

In production

Store parents in a plain key value store and children in the vector index, linked by id. Cap parent size, because a 5,000 token section returned three times defeats the purpose. For multi representation, generate summaries or questions once at index time and keep the generation prompt in version control; when the prompt changes, regenerate.

Watch out

Common mistakes

  • Small chunks are always more precise. On their own they found 42 of 47; their parents found 44.
  • Parent child is only for long documents. It helps wherever sections are natural answer units.
  • Any child-to-parent mapping works. A child that crosses a boundary breaks it.

Check yourself

Remember this

Remember these

  • Search small, answer with the section the small piece came from.
  • Children are split from inside each parent, never across a boundary.
  • Here: 44 of 47 answers with 404 instead of 817 context tokens.
  • Multi representation goes further: index summaries or questions, return the original.

Say it in an interview

  1. 01Parent child search ranks small children and returns their parent section to the model.
  2. 02Children must be split from inside each parent, or the mapping breaks.
  3. 03On my corpus it matched recursive 512 at 44 of 47 with 404 instead of 817 context tokens.
  4. 04My first version made children separately and dropped to 26 of 47, which taught me that.
  5. 05Multi representation indexes summaries or questions, but always returns the original passage.

Quick quiz

Three questions

Question 1

Q1

Parent child retrieval on our corpus matched recursive 512 on recall. What did it save?

Question 2

Q2

Why must children be split from inside their parent?

Question 3

Q3 · from RAG-14

Which chunking strategy follows headings, and makes natural parents?

Saved on this device. No account needed.