Skip to content
GenAI Learn/Document Ingestion & Chunking
Browsing as a guest. Sign in to save your progress and earn XP as you complete chapters.

Chunking Strategies That Actually Work

7 min read

You'll learn to

  • -Compare fixed-size, semantic, and parent-child chunking strategies
  • -Reason about chunk size and overlap tradeoffs with a concrete example
  • -Recognize when a fact split across a chunk boundary silently breaks retrieval

A RAG system retrieves relevant-looking chunks, but the answers keep coming out wrong. The reason: critical context is being split across chunk boundaries. A drug name mentioned in one sentence gets separated from its dangerous interaction described in the very next sentence, and whichever chunk gets retrieved contains only half the fact. This is one of the most common, hardest-to-notice bugs in a RAG system, because retrieval looks like it is working, the chunks it returns really are topically relevant, they are just incomplete.

Fixed-Size Chunking: Simple, and Exactly This Fragile

The simplest strategy splits a document into fixed-length pieces (by character count or token count), optionally with some overlap between consecutive chunks so content near a boundary appears in more than one chunk. It is trivial to implement and fast to run over millions of documents, but it is also blind to sentence and paragraph structure, a boundary can and will land in the middle of exactly the wrong sentence.

The exact chunking function the interactive demo below uses.

At a chunk size of 90 characters, the critical fact splits across two separate chunks, exactly the failure mode above. At 150 characters, both sentences happen to fit together in the same chunk, and the fact survives intact. Notice this was not fixed by adding overlap, it was fixed by the boundary simply falling somewhere else. Overlap helps only when it is generous enough to actually bridge the specific gap between two related facts, which is not guaranteed just because some overlap exists at all.

Chunk Size, Overlap, and a Fact That Spans a Boundary

The drug name and its dangerous interaction sit in adjacent sentences. Watch when chunking separates them.

Patients should take Warfarin once daily with food. This medication interacts dangerously with aspirin, increasing bleeding risk. Dosage should be reviewed every three months by a physician. Missing a dose is generally safe to skip rather than double up.
chunk 1: Patients should take Warfarin once daily…
chunk 2: with aspirin, increasing bleeding risk. …
chunk 3: physician. Missing a dose is generally s…
Chunk size90 characters
Overlap0 characters

Split across chunks: no single chunk mentions both "Warfarin" and its aspirin interaction.

Semantic Chunking: Splitting Where Meaning Actually Changes

Instead of cutting at a fixed character count, semantic chunking looks for natural breakpoints: embed consecutive sentences, and split where the similarity between adjacent sentences drops noticeably, the point where the topic actually shifts. This produces chunks that respect the document's real structure, at the cost of an extra embedding pass during ingestion and a less predictable chunk size (some topics are naturally covered in two sentences, others in twenty).

Parent-Child Chunking: Precise Search, Full Context

A genuinely useful middle ground: index small, precise chunks for search (a single paragraph, easy to match tightly against a specific query), but when one is retrieved, hand the model its larger parent chunk (the full section or document it came from) for actual generation. Small chunks make retrieval precise; large context makes generation well-informed. Keeping them as two different granularities, linked by a parent-child relationship in the metadata, gets both properties instead of trading one for the other.

A Practical Starting Point (Then Tune to Your Documents)
~300-500 tokens
A common default chunk size for prose documents
~10-20%
A common overlap, as a fraction of chunk size
Small
Chunk size that helps precision, hurts standalone context
Large
Chunk size that helps context, hurts retrieval precision

There is no universally correct chunk size. Legal contracts, chat logs, and API documentation all have wildly different natural structure, and the only reliable way to choose is to test retrieval quality against real questions on your actual documents, not to copy a default from a blog post.

Interview Signal is part of Pro

See a real weak answer next to a real strong one for this exact topic.

Quiz is part of Pro

Test what you just read with a short quiz, and bank the XP.

Ready to Build This?

Build the Document Ingester and Chunk Master levels in the GenAI Lab.

ScaleDojo Logo
Initializing ScaleDojo