Skip to main content
AI / MLRetrieval & RAGDiagramBeginner

Chunking Strategy

KO: 청킹 전략·EN: Chunking Strategy·JA: チャンキング戦略

The preprocessing strategy for splitting long documents into semantically coherent, appropriately sized chunks with overlap and metadata to maximize RAG retrieval quality

Table of Contents

Structure Diagram

Fixed-Size vs Structure-Aware Overlap Chunking
Fixed Split (Context Cut)3 steps
Semantic + Overlap3 steps
STEP 1Chunk 1 (Table Cut)(33%)
Quick Answer

What is Chunking Strategy?

The preprocessing strategy for splitting long documents into semantically coherent, appropriately sized chunks with overlap and metadata to maximize RAG retrieval quality. It is a core concept in Retrieval & RAG within AI / ML.

Core Principles

Chunking splits long source documents into retrieval-sized units before embedding. Chunks that are too large dilute vector semantics across multiple topics and waste context budget, whereas chunks that are too small lose surrounding context and pronouns.

Production RAG pipelines favor structure-aware splitting along headings, paragraphs, and tables, paired with 10–20% overlap or Parent-Child Retrieval (indexing small child chunks while feeding the full parent section to the LLM).

Practical Takeaways

  • Prepend contextual breadcrumbs to every chunk: Standalone snippets like "This exception applies here" lose meaning. Prefix each chunk with Document Title > Section > Subsection before embedding.
  • Keep tables and code blocks intact: Splitting mid-table detaches column headers from values. Parse tables atomically or pair them with natural-language summaries.
  • Start with 300–600 tokens and measure: Establish a baseline with recursive structure-aware splitting and tune chunk size using retrieval recall metrics rather than guesswork.

Notable Examples

  • Developer Docs RAG: Splits on Markdown headings and preserves code fences via AST/Markdown parsers.
  • Contextual Retrieval: Prepends a short LLM-generated document summary to each chunk prior to indexing, sharply reducing retrieval failures.
  • Legal & Policy Search: Chunks strictly along numbered clauses while retaining chapter and effective-date metadata.