Chunking strategies
Choose chunk boundaries and sizes that keep ideas whole and make retrieval precise.
A chunk is the unit you retrieve and the unit the model reads. Fixed-size splitting is easy and cuts sentences in half. Recursive splitting tries paragraph, then sentence, then word boundaries to avoid that. Structure-aware splitting follows headings and sections, which usually keeps ideas intact. Semantic splitting places boundaries where meaning shifts, at extra cost.
Size is a trade. Small chunks match queries precisely but lose context. Large chunks keep context but dilute the embedding and waste prompt tokens. A strong pattern is parent-child retrieval: embed small chunks for precise matching, then return the larger parent section to the model. Overlap helps a little when boundaries are arbitrary, but it also creates near-duplicates.
Make each chunk understandable on its own by prefixing the document title and section path, and consider generating a one-line context note for chunks that rely on surrounding text. Then choose size with an eval on your own questions, not a rule of thumb.
Key points
- Prefer structure-aware or recursive splitting over blind fixed windows.
- Parent-child retrieval gives precise matching with enough context.
- Prefix chunks with title and section path so they stand alone.
- Pick size and overlap by measuring retrieval on your own queries.
Trade-offs
| Choice | You gain | You pay |
|---|---|---|
| Small chunks | Precise matches, cheaper prompts | Fragmented context, more chunks to store |
| Large chunks | Self-contained context | Diluted embeddings, more tokens per answer |
| Parent-child | Precision and context together | Extra storage and a lookup step |
Answer these out loud
- 1A policy document has numbered clauses that refer to 'the above'. How do you chunk so the reference survives?
- 2Design an experiment that picks between 256, 512 and 1024 tokens using recall@5.
Build it
Implement recursive and heading-based chunkers, run both over the same corpus with a 30-question set, and compare recall@5.
Use this from an agent
Any MCP client, including Grok, can read this lesson. See how to connect.
curl https://engineeros-delta.vercel.app/api/v1/topics/rag-chunking-strategies