You are tuning chunk size in a RAG pipeline. What is the core tradeoff between very small chunks (e.g. 128 tokens) and very large chunks (e.g. 2000 tokens)?
Small chunks pin retrieval to a precise sentence but starve the LLM of context. Large chunks carry context but their averaged embedding blurs the semantic target and hurts recall.
Imagine looking up a fact in a textbook. If your search index points to individual sentences, you land on the exact line you want, but you may not understand it without the paragraph around it. If your index points to whole chapters, you always get the surrounding story, but searches for one specific fact often miss because the chapter is about many things at once and the average is fuzzy. RAG chunking has the same shape: it is like choosing between a sticky note bookmark and a chapter bookmark. Tiny chunks are precise but lonely. Giant chunks are rich but blurry. Good systems pick a middle size and use a trick called parent-document retrieval, where small chunks are searched but the bigger surrounding paragraph is what the model actually reads.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: state the two opposing pressures, explain why a single vector cannot losslessly represent 2000 tokens, give the parent-document mitigation, then name the metrics you'd tune against.
| Property | Small chunks (128-256) | Mid chunks (256-512) | Large chunks (1500-2000+) |
|---|---|---|---|
| Retrieval precision | High; pins to exact sentence | Solid for most queries | Lower; embedding averages topics |
| LLM context per hit | Sparse; may starve the model | Usually enough for one idea | Rich, full paragraph or section |
| Embedding faithfulness | High; one semantic unit | Reasonable | Blurry centroid over many ideas |
| Best for | Fact lookup, exact phrasing | General-purpose RAG default | Summarization, narrative QA |
| Failure mode | Under-grounded answers | Edge cases either way | Wrong chunk ranks first |
| Storage cost | More vectors, more index | Balanced | Fewer vectors, less index |
Real products, models, and research that use this idea.
- LlamaIndex ships `SentenceWindowNodeParser` and `AutoMergingRetriever`, which embed small windows and return larger merged parents to the model, the canonical implementation of parent-document retrieval.
- LangChain's `ParentDocumentRetriever` does the same pattern: small child chunks for embedding precision, larger parent chunks for prompt context.
- Pinecone, Weaviate, and Qdrant all expose chunk metadata fields so you can store small embedding vectors but return larger associated parent text at query time.
- Voyage Embed v3 and OpenAI text-embedding-3-large support inputs up to 32K and 8K tokens respectively, but production teams still chunk to a few hundred tokens because the single output vector cannot losslessly represent long inputs.
What an interviewer would ask next. Try answering before peeking at the approach.
QWalk me through parent-document retrieval. What problem does it solve and what does it cost?
QHow would you pick a chunk size for a new corpus when you have no labeled eval set yet?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating chunk size as a fixed default rather than a tunable knob, or assuming a single large vector can represent a 2000-token passage without blurring its semantics.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.