RAG & Retrieval·Question 5 of 100Basic

How do chunk size and overlap affect retrieval quality, and what numbers would you start with?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Start with ~512 tokens per chunk, 10-20% overlap, then tune against a retrieval eval set - but know the mechanism, not just the numbers.

Full worked answer with diagram

Start with ~512 tokens per chunk, 10-20% overlap, then tune against a retrieval eval set - but know the mechanism, not just the numbers.

Small chunks (128-256 tokens): each embedding represents one focused idea, so query-chunk similarity is sharp and precision is high. But you fragment reasoning across chunks - the answer to "what's the refund window for enterprise plans?" might need three adjacent fragments - and the LLM receives disconnected snippets missing surrounding context. You also multiply chunk count: more vectors, more storage, more index memory.

Large chunks (1024-2048 tokens): more coherent context per retrieval, fewer chunks to manage. But the embedding becomes a blurry average of multiple topics - a chunk covering refunds and billing and cancellation matches all three queries weakly instead of one strongly - so recall on specific questions drops. Long chunks also eat your context budget: at 5 chunks × 2000 tokens you're spending 10k tokens per query, with attendant cost and lost-in-the-middle risk.

Overlap (repeating the tail of one chunk at the head of the next) insures against a fact straddling a boundary. 10-20% is typical; beyond that you're storing near-duplicates that crowd top-k with redundant results - dedupe at assembly if you use heavy overlap.

The senior move is to break the coupling entirely: retrieve small, generate big. Index 200-token chunks for precise matching, but return each hit's parent section (or ±1 neighbouring chunks) to the LLM. You get small-chunk retrieval precision with large-chunk generation context, and the "optimal chunk size" question mostly dissolves. Whatever you pick, validate with recall@k on a golden set - the optimum is corpus- and query-distribution-dependent, and intuition is a poor guide.

Worth sketching. It makes the point that chunk size is two decisions, not one, and that the retrieval unit does not have to be the generation unit.

flowchart LR
    D["Parent section,<br/>~2000 tokens"] --> S["Split into<br/>200-token children"]
    S --> V["Embed children only"]
    Q["Query"] --> M["ANN match over<br/>child vectors"]
    V --> M
    M --> H["Top-k children"]
    H --> P["Resolve parent_id"]
    P --> G["Hand the model<br/>the parent section"]

What a good answer covers

  • Start with ~512 tokens per chunk, 10-20% overlap, then tune against a retrieval eval set - but know the…
  • Small chunks (128-256 tokens)
  • But you fragment reasoning across chunks - the answer to "what's the refund window for enterprise…
  • You also multiply chunk count: more vectors, more storage, more index memory
  • Large chunks (1024-2048 tokens): more coherent context per retrieval, fewer chunks to manage

Key terms: Small chunks (128-256 tokens) · Large chunks (1024-2048 tokens) · Overlap · retrieve small, generate big

Interviewer follow-ups to expect

  1. Why does a multi-topic chunk embed poorly - what's happening in vector space?

  2. How does your answer change for a corpus of tweets vs legal contracts?

  3. What metric tells you your chunks are too big?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep