Chunking decides what your retrieval system can physically find, because the model only ever sees whole chunks — never the source document, never the full table it came from. Split a clause from its exception, or cut a table mid-row, and no prompt fixes what retrieval never surfaced. That's chunking for retrieval quality, not chunking for storage.

Retrieval quality is capped by chunk quality, not model quality — a chunk is the smallest unit of truth the model ever sees. A sound RAG chunking strategy balances fixed-size, semantic, and structural splitting against the shape of the source document. Get size, overlap, and boundaries right before touching a prompt.

Why Chunking Is a Product Decision, Not a Pipeline Detail

Chunking is a product decision because it sets the ceiling on what a retrieval-augmented system can ever answer correctly — the model never reads your source documents, only whatever chunks your pipeline chose to store. Every downstream failure, from confident hallucination to a missed exception clause, traces back to a chunking choice made months earlier, quietly, during ingestion.

Most teams hand chunking to whoever sets up the vector database, then move straight to prompt tuning when answers disappoint. That's backwards.

A chunk is the retrieval-era search snippet: it has to stand alone, or it doesn't count.

Treat chunking with the same rigor you'd bring to any other user-facing spec. For a broader map of the decisions a retrieval system forces on a team, see our complete guide to RAG knowledge systems — chunking is one of the four product decisions RAG forces on every team, alongside embedding choice, retrieval strategy, and grounding.

Careless chunking produces a specific, recognizable failure signature:

  • Answers that cite a policy correctly but omit its exception, because the exception sits in a different chunk than the rule.
  • Numbers detached from the column header that gives them meaning, because a table row was split mid-cell.
  • Summaries that grab the wrong quarter or version, because chunk boundaries carried no date or source metadata.

None of these are prompt problems. They're chunking problems wearing a prompt-shaped disguise, and no "please double-check your answer" instruction recovers information that was never retrievable in the first place.

Fixed-Size, Semantic, and Structural Chunking: The Core RAG Chunking Strategies Compared

Three families of chunking dominate production retrieval systems: fixed-size splitting by token or character count, semantic chunking that groups text where meaning shifts, and structural chunking that respects a document's own architecture — headings, table rows, list items. Each trades implementation cost against fidelity to what a chunk should actually contain.

  1. Fixed-size chunking splits every N tokens or characters, often with a fixed overlap. It's the default in most RAG starter kits because it needs no understanding of the content — just a tokenizer and a loop.
  2. Semantic chunking embeds sentences or small windows and cuts where similarity between neighbors drops, an approach popularized by Greg Kamradt's widely-cited "5 Levels of Text Splitting" walkthrough for LangChain. Boundaries track topic shifts instead of a token counter.
  3. Structural chunking parses the document's own structure first — headings, sections, table cells, list items — using a layout-aware parser (tools like unstructured are built for exactly this), then splits along those existing seams.
StrategyHow it splitsStrengthsTypical failure modeBest fit
Fixed-sizeEvery N tokens/characters, with overlapCheap, fast, deterministic, easy to reason aboutCuts sentences, table rows, and logical units mid-thoughtPrototypes, homogeneous prose
SemanticEmbeds text, splits where similarity dropsChunks track topic and argument boundariesCompute-heavy; unstable on repetitive or list-heavy textLong-form articles, transcripts, narrative docs
StructuralParses document layout, then splits along real seamsPreserves tables, code blocks, and hierarchyNeeds a format-aware parser per document typePDFs, contracts, spec sheets, technical docs

LlamaIndex's node-parsing and sentence-window retrieval documentation makes a related point worth borrowing regardless of which strategy you pick: the chunk you embed and the chunk you return to the model don't have to be the same size. You can embed a small, precise unit for matching, then expand it to a larger window — heading, neighbors, or full section — once it's selected for the prompt.

A Worked Example: How Naive Chunking Breaks a Table

Run a fixed-size splitter over a pricing table or PDF invoice and it will cut mid-row, separating a number from the column header that gives it meaning. The chunk is technically retrieved and even scores well on similarity, but it's semantically useless — the model gets a price with no idea which plan it belongs to.

Take a simple product spec sheet:

PlanMonthly PriceSeat LimitOverage Fee
Starter$295$8/seat
Growth$9920$6/seat
EnterpriseCustomUnlimitedN/A

A 500-token fixed-size splitter, extracting raw text top to bottom, doesn't know a table exists. It counts characters and cuts wherever the count runs out — which might land right between Growth | $99 | 20 and $6/seat. Chunk one now ends mid-row; chunk two opens with an orphaned fee and no header row to anchor it.

Ask "what's the overage fee for the Growth plan?" and the retriever pulls chunk two, because overage fee and $6/seat are both there. What it can't return is the fact that $6/seat belongs to Growth and not Enterprise — that link lived in a row that no longer exists as a single unit. The model will either guess, hedge, or confidently attribute the fee to the wrong plan.

The same failure shows up in PDFs even without a table: multi-column layouts, extracted naively, interleave two columns of unrelated text into one incoherent chunk, because raw text extraction reads left-to-right across the page rather than down each column. A layout-aware parser is the fix in both cases, and it's the same fix:

  1. Detect the structure first. Identify table regions, columns, and headings before any splitter touches the text — this is what layout-aware tools like unstructured are built for.
  2. Serialize each row as a self-contained statement. Rewrite the Growth row as "Plan: Growth. Monthly Price: $99. Seat Limit: 20. Overage Fee: $6/seat." so the header travels with the value even after the row becomes its own chunk.
  3. Attach table-level metadata to every row-chunk. Source page, table title, and effective date should ride along as metadata, not get lost when the row is isolated.
  4. Never let a fixed-size splitter run over a detected table or code region. Structural boundaries always win over token counts inside these regions.

The Chunk-Size-vs-Recall Curve: Why Bigger Isn't Always Better

Recall against a fixed set of test queries typically rises as chunk size grows from very small to moderate, then plateaus and eventually falls as chunks grow so large that unrelated text dilutes the embedding and buries the real answer inside noise. Precision moves in roughly the opposite direction the entire time.

Picture the curve directionally, not as exact numbers your pipeline will reproduce:

Chunk size (approx. tokens)Recall trendPrecision trendWhat's happening
~50–100LowHighChunks are too small to hold a full answer; matches are exact but incomplete
~200–400RisingHigh to moderateSweet spot for most prose — enough context per chunk without diluting the embedding
~500–800Peaking, then flatteningModerateDiminishing returns; multiple topics start blurring into one embedding
1000+FallingLowThe embedding becomes an average of several topics; the true answer is present but drowned out

The mechanism behind the fall is straightforward: an embedding is a single vector summarizing everything in the chunk. Cram three topics into one chunk and the vector represents an average of all three — a query about any single topic now matches less precisely, even though the answer is technically sitting right there in the text.

Anthropic's published research on contextual retrieval makes a related point from the opposite direction: chunks sized correctly but stripped of surrounding context still underperform, because the embedding carries no signal about which larger document or section the chunk belongs to. The fix is a short, auto-generated context sentence prepended to each chunk before embedding, restating what the chunk is part of.

That prepending step cut retrieval failures by roughly a third in Anthropic's published tests, and combined with reranking, roughly halved them. Size matters, but so does what accompanies the chunk into the embedding.

There's a second, easy-to-miss curve intersecting this one: where a retrieved chunk lands inside the assembled context matters almost as much as whether it was retrieved. Stanford researchers' "Lost in the Middle" findings showed that models are directionally less reliable at using information buried in the middle of a long context versus the start or end — a reminder that solving recall doesn't automatically solve usage.

None of this is something you can eyeball once and forget. Recall and precision drift as your document set grows and changes, which is why treating retrieval quality as an ongoing measurement problem — not a one-time tuning pass — matters; our guide to LLMOps and observability covers what to actually track once chunking ships to production.

Chunk Size and Overlap: Boundary Design Rules That Prevent Silent Failures

Overlap exists to stop boundary information from disappearing — repeating the tail of one chunk at the head of the next so a sentence split across two chunks still appears whole in at least one of them. Too much overlap multiplies storage and duplicate matches; too little recreates the exact problem overlap was meant to solve.

A workable default is 10-20% overlap relative to chunk size, tuned per document type rather than applied uniformly across a whole corpus. Dense technical or legal text benefits from the higher end of that range; loosely structured prose can often get away with less.

Overlap is insurance, not a substitute for good boundaries. The table-splitting problem from the worked example isn't solved by adding overlap — it's solved by never letting a splitter cross a row boundary in the first place. Overlap only helps when the unit being split is genuinely continuous prose, where losing a sentence at the seam is the real risk.

Four boundary rules hold regardless of which chunking strategy you're running:

  1. Never split mid-sentence, even in fixed-size mode — snap the cut to the nearest sentence terminator rather than an exact token count.
  2. Never split a detected table, code block, or list without serializing it into self-contained units first.
  3. Carry heading breadcrumbs forward as metadata, not just as text the model has to re-infer from context — a chunk should know which section it came from.
  4. Re-chunk when the source document changes version, rather than leaving stale chunks alongside new ones; a stale chunk that resembles the truth is worse than a missing one.

That fourth rule has a workflow implication worth naming directly: re-chunking on document change is a trigger-and-pipeline problem, not a manual one. Wiring ingestion to fire automatically off a document-management webhook or a scheduled diff-check follows the same pattern used in broader workflow automation design — the trigger just happens to be "a source document changed" instead of a customer action.

Overlap and boundaries also matter more, not less, once an agent sits in the loop. An agent that has to issue three follow-up retrieval calls to reassemble information a cleaner chunk boundary would have kept together is burning latency and context budget on every turn; see our guide to AI agents for how retrieval quality compounds across a multi-step agentic loop rather than a single question-answer pass.

Building Chunking Into Your Product Workflow

Chunking decisions deserve the same design scrutiny as any other user-facing spec, because the chunk is the unit of truth the model reasons over — not the source document, not your intentions, just whatever text made it in. Teams that sketch the retrieval experience before writing a splitter catch failures on paper, not in a ticket.

That's the same discipline behind wireframing a screen before building it: you're forcing the hard questions — what does this unit need to contain to stand alone, what's the smallest complete answer — into a cheap, editable stage instead of a production incident. A chunk is a wireframe for a single retrieved fact.

Prodinja's Context Engineering tool is designed around this exact gap: instead of only tuning a splitter's parameters and re-running retrieval blind, it's meant to let you reason about what a retrieved chunk should actually contain — its boundaries, its metadata, its size relative to the model's context budget — before that chunk ever reaches the prompt. It's a prototype experience today, built to make chunk design a visible, reviewable step rather than a buried config value.

The practical habit worth adopting, tool aside: before you finalize a RAG chunking strategy, pull five real documents from your actual corpus — including at least one table and one multi-column PDF — and manually check what a naive splitter does to each. If you can't describe what a chunk would look like in isolation, with no other context, for your worst document, don't ship yet.

Key Takeaways

  • Chunking sets the ceiling on retrieval quality — the model never sees your source document, only the chunks your pipeline chose to store, so no prompt recovers information that retrieval never surfaced.
  • Fixed-size chunking is cheap but blind; it will cut sentences, table rows, and logical units mid-thought unless boundaries are respected explicitly.
  • Semantic and structural chunking cost more to build but preserve meaning and document architecture respectively — pick based on whether your corpus is narrative prose or structured documents like tables and contracts.
  • Recall rises then falls as chunk size grows, because oversized chunks average multiple topics into one embedding and bury the real answer in noise.
  • Overlap is insurance against boundary loss, not a fix for bad boundaries — a 10-20% default is reasonable, but it can't rescue a table split mid-row.
  • Tables and PDFs need structure-aware parsing before splitting, with each row serialized as a self-contained statement carrying its own headers and metadata.
  • Re-chunking is a workflow-automation problem, not a one-time task — wire it to fire when source documents change, and monitor recall and precision as they drift.

Frequently Asked Questions

What is the best chunk size for RAG?

There's no universal best size — for most prose-heavy corpora, 200-400 tokens with 10-20% overlap is a reasonable starting point, but the right size depends on your document type, query patterns, and embedding model's context handling. Test against your own queries and measure recall and precision directly rather than copying a number from a blog post, including this one.

Should I use overlap when chunking for RAG?

Yes, in most cases — overlap is cheap insurance against splitting a sentence or idea across a chunk boundary. Use it as a supplement to good boundary rules (never split mid-sentence, mid-row, or mid-table), not as a replacement for them; overlap alone can't fix a table cut in half.

How do you chunk tables and PDFs without breaking them?

Detect the table or layout structure before running any general-purpose splitter over the text, using a layout-aware parser rather than raw text extraction. Serialize each row as a self-contained statement that restates its own headers, and attach table-level metadata like source page and date to every resulting chunk.

What's the difference between semantic and structural chunking?

Semantic chunking splits based on meaning — it embeds text and cuts where topic similarity drops between neighboring sentences. Structural chunking splits based on the document's own architecture — headings, table cells, list items — parsed before any splitting decision is made; the two are often combined, with structure setting hard boundaries and semantics refining cuts within them.

How often should I re-chunk a knowledge base?

Re-chunk whenever a source document changes version, and treat that as an automated trigger rather than a manual task tied to someone remembering. A stale chunk that resembles the current truth is more dangerous than a missing chunk, because it will be retrieved and trusted without anyone flagging that the source moved on.