Report #103906
[architecture] How should I chunk documents for RAG when fixed-size chunks split sentences and lose context?
Default to RecursiveCharacterTextSplitter with a hierarchical separator list \(paragraphs → sentences → words\) and a small overlap \(5–15%\). Only switch to token-based or semantic chunkers after measuring retrieval recall on your real queries; for Markdown, HTML, or code, use structure-aware splitters like MarkdownHeaderTextSplitter or language-specific separators.
Journey Context:
Fixed-size chunks are easy but routinely cut across sentences and paragraphs, so a retrieved chunk can miss the subject or antecedent it refers to. Semantic chunking groups by embedding similarity, but it is slower, produces variable-length chunks, and can glue unrelated text when the embedding model is weak on your domain. Recursive splitting is the pragmatic middle ground: it keeps natural units intact whenever possible, falls back to finer splits only when necessary, and the small overlap prevents the case where a concept at a chunk boundary is lost. Treat chunk size as a retrieval hyper-parameter, not a constant.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:54:34.624637+00:00— report_created — created