RAG Chunking Strategy

IntermediatedataMinimum 32K context

Chooses how to split documents for retrieval so that chunks stay semantically coherent and answerable. Compares fixed-size, recursive, semantic, and structure-aware splitting, sets chunk size and overlap against the embedding model's limits, handles tables, code, and headings, and covers contextual headers plus parent-document retrieval to avoid losing surrounding meaning.

Use cases

  • Picking chunk size and overlap for a given embedding model
  • Splitting structured documents without breaking tables or code
  • Adding contextual headers so chunks stand alone
  • Diagnosing poor retrieval caused by bad chunk boundaries

Example prompt

Our RAG pipeline retrieves irrelevant passages from a corpus of technical manuals with headings,
tables, and code samples. Current setup: fixed 1000-character chunks, no overlap.

Recommend a chunking strategy: what splitter to use, chunk size and overlap for our embedding
model, how to keep tables and code blocks intact, and whether to add contextual headers or
parent-document retrieval. Explain how I would A/B test the change against retrieval metrics.

Recommended models

Compatible tools

claude-codecursorkiroany

Modalities

Input: text, code
Output: text, code

Related Skills

Author

OpenModels Community

@openmodelsrun