Chunking

Category: Generative AI / LLM

The process of splitting documents into smaller segments for indexing in a RAG system, balancing context completeness with retrieval precision.

Full Explanation

Chunking is a critical preprocessing step in RAG pipelines that determines how documents are divided into segments for embedding and retrieval. Common strategies include fixed-size chunking (splitting by character or token count with overlap), recursive chunking (splitting by structural elements like paragraphs and sections), and semantic chunking (splitting at points where the topic or meaning shifts). The chunk size significantly affects RAG quality: too small chunks may lack context, while too large chunks may dilute relevant information and exceed model context limits. Overlap between adjacent chunks helps preserve context at boundaries. Advanced approaches include document-aware chunking that respects headings and sections, and parent-child chunking where small chunks are retrieved but larger parent sections are passed to the model. Choosing the right chunking strategy is one of the most impactful decisions in RAG system design.

Related Terms

More in Generative AI / LLM

Explore More