Chunking

Splitting long documents into smaller passages before indexing so each piece fits in retrieval and LLM context.

Documents are typically too long to retrieve and feed to an LLM whole. Chunking splits them into passages (200-1,000 tokens) for indexing. Strategy matters: fixed-size chunks are simple but break semantic units; recursive splitting respects markdown / section boundaries; sentence-window chunking retrieves the matched sentence plus surrounding context. Bad chunking is one of the most common causes of poor RAG quality.