CONCEPT

Chunking Strategies

Authoritative Definition

Techniques for dividing long documents into smaller, discrete text blocks to optimize embedding quality and retrieval precision within a vector database for RAG applications.

Overview & Technical Description

Chunking is a critical preprocessing step in building retrieval systems. Language models and embedding models have limited context windows and token constraints, meaning entire books or long reports cannot be embedded or injected as single cohesive units. Chunking strategies dictate how text is broken down. Simple methods include fixed-size chunking (e.g., 500 tokens with a 50-token overlap). More advanced methods involve semantic chunking, where documents are split based on natural linguistic boundaries like sentences, paragraphs, or markdown headers to preserve the original meaning. Advanced architectures often employ hierarchical or parent-child chunking. In this approach, a document is split into small chunks for precise embedding and high-accuracy retrieval, but each small chunk points to a larger "parent" chunk. When a small chunk is retrieved, the RAG system injects the larger parent chunk into the LLM's context. Sentence-window retrieval is a variation of this, fetching the matching sentence along with a buffer of surrounding sentences. The choice of chunking strategy directly dictates the retrieval accuracy and context quality of a RAG pipeline. Poor chunking can split a crucial thought in half, destroying its semantic value for the embedding model, or create chunks so large they dilute the specific answer. Implementing intelligent chunking is foundational to reducing hallucination and ensuring an LLM receives focused, relevant information.

Editorial Notes

A common edge case involves tabular data or code blocks; naive fixed-size chunking will break the structure, rendering it useless. Production systems should use format-aware chunkers (e.g., HTML, Markdown, JSON splitters). Overlap is crucial to prevent boundary data loss, but excessive overlap inflates the index size and vector search latency.

Related Concepts

Companies Implementing Chunking Strategies

2 listed

Products & Tools