RAG Chunking Strategies: How Chunk Size Affects Retrieval Quality

By

Tom Dallimore

Published

Chunking is one of those RAG decisions that looks boring right up until it starts ruining your answers. Split a document too aggressively and you retrieve fragments that have lost the sentence, heading, exception, or definition that made them useful. Make the chunks enormous and every embedding becomes a vague soup of five different topics. Then the retriever returns something that is technically related and completely useless. Lovely.

The annoying part is there is no magical best chunking strategy that works for every knowledge base. The right chunk size and chunking method depend on your document structure, the questions people actually ask, your embedding model, and how much context the language model needs to answer properly.

This guide walks through the chunking strategies I would actually test in a production RAG pipeline: fixed size chunking, paragraph based chunking, structure-aware splitting, semantic chunking, contextual chunking, adaptive chunking, recursive chunking, and agentic chunking. More importantly, we will look at why they fail, because that is normally where the useful lessons are.

If you want the wider plumbing first, my RAG pipeline guide covers ingestion through generation, and the RAG architecture guide shows how chunking fits into the rest of a production system.

Bottom line: chunk for retrieval, not because 512 looked like a respectable number in somebody else's tutorial.

What Is RAG Chunking, Exactly?

RAG chunking is the chunking process that turns large source documents into smaller retrievable units. In a typical retrieval augmented generation system, you create chunks, generate an embedding for each one, store the chunked data in a vector database or another search index, and retrieve the most relevant chunks when a user asks a question.

The important distinction is that an entire document, a stored chunk, and the final snippet sent to the large language model are not necessarily the same thing. A 40-page report may become hundreds of chunks during ingestion. At query time, the retrieval process might return five relevant chunks, expand one with neighboring chunks, rerank the candidates, and only then build the relevant context for generation.

Chunk boundaries matter because documents are not just bags of words. Headings, paragraphs, tables, code blocks, definitions, exceptions, and previous chunk context all carry meaning. A good chunk is small enough to retrieve precisely but complete enough to make sense on its own.

If you are new to the overall idea, start with RAG explained. If you already know the basics, carry on.

Why Chunking Strategy Matters for Retrieval Quality

Chunking strategies shape the evidence your RAG systems can retrieve. Each chunk becomes a search unit. If one chunk mixes three unrelated topics, the embedding has to represent all three. If another chunk cuts an exception away from the rule it qualifies, the retrieval layer may find the rule and completely miss the exception.

That is why poor chunking often looks like an LLM problem. The model gives an inaccurate answer, everybody starts debating which language model to swap in, and nobody notices that the relevant information never reached the prompt in the first place. A bigger model cannot reason over evidence it never saw.

Smaller chunks usually improve retrieval precision because they isolate specific data and specific facts. But they can lose sufficient context. Larger chunks preserve more surrounding information, but they can dilute semantic meaning and make retrieval accuracy worse because one vector is now describing too many ideas at once.

If this sounds familiar, it is the same retrieval-first problem I cover in How to Improve RAG Performance. Fix the evidence before blaming the generator.

Chunk Size: The Retrieval vs Context Trade-Off

Chunk size is simply the amount of content you put into one retrievable unit, usually measured in tokens or characters. The optimal chunk size is not the biggest size your context window can tolerate. It is the size that gives the retriever a strong relevance signal while preserving context the answer depends on.

Think about a product manual. A 150-token chunk might contain the exact sentence about battery life, which is great for a narrow lookup. But if the next sentence says “only when power-saving mode is enabled,” splitting those two sentences apart gives you a very efficient way to retrieve half an answer.

At the other extreme, a 2,000-token chunk might preserve every caveat but also include setup instructions, warranty terms, accessories, and troubleshooting. The embedding model now has to compress all of that into one representation. Semantic similarity becomes less discriminative because the chunk is about everything and therefore, in a useful retrieval sense, not especially about anything.

RAG Engineer choosing chunk size

For general English knowledge bases, I normally start by testing a few sensible sizes rather than declaring a winner in advance: something around 256 tokens, 512 tokens, and 1,024 tokens. Respect the embedding model token limits and any maximum chunk size in your pipeline, then evaluate what happens on real questions. The context window matters, but it should not be your only design input.

If a chunk only makes sense after you read the previous chunk, you have not really preserved the context. You have just moved the problem downstream.

Too small vs Too large. How chunk size affects retrieval quality

The Main Chunking Approaches

Chunking approaches are a toolbox. Different document types and query patterns need different tools, and multiple chunking strategies can coexist in the same corpus. There is no prize for forcing every PDF, Slack thread, Markdown file, contract, and code repository through one splitter.

Fixed-Size Chunking: Your Baseline

Fixed size chunking splits text at predetermined token or character counts, usually with some overlap. It is simple, cheap, predictable, and still a perfectly reasonable baseline for unstructured documents, OCR text, logs, and prototypes.

The weakness is obvious: fixed-size chunking does not care about semantic boundaries. A 512-token window will happily cut a paragraph, table, sentence, or definition in half because the counter reached 512. Adding overlap helps, but overlap is insurance, not intelligence.

Use it to establish a baseline. If a clever semantic or contextual approach cannot beat the boring fixed-size version on your evaluation set, congratulations: you just saved yourself complexity.

Sentence and Paragraph Based Chunking

Sentence- and paragraph based chunking puts chunk boundaries where humans already put boundaries. Instead of slicing at arbitrary token counts, it groups one or multiple sentences or keeps paragraphs intact. This is often a good fit for FAQs, blogs, support content, and other text where each paragraph already expresses one reasonably coherent idea.

The trade-off is variable chunk sizes. One paragraph may be 30 tokens and the next may be 400. That can be fine, but you still need guardrails so one heroic paragraph does not become an entire document wearing a fake moustache.

Structure-Aware and Recursive Chunking

Structure-aware chunking uses document structure first: headings, sections, lists, code blocks, tables, and layout. Highly structured documents such as Markdown files, API references, technical documents, and product manuals are practically begging you to use the structure they already have.

Recursive chunking is a useful extension. You split by the strongest boundary first, then fall back to smaller separators when a section is still too large: section → paragraph → sentence → token window. That lets you create chunks based on natural hierarchy without ignoring the maximum chunk size your embedding pipeline can handle.

The failure mode is bad structure. OCR PDFs with fake headings, copied email threads, and inconsistent markup can produce terrible chunks if you trust the layout blindly. Structure is a signal, not a religion.

Semantic Chunking: Split When the Meaning Changes

Semantic chunking looks for changes in semantic meaning rather than raw length. A common implementation embeds consecutive sentences or paragraphs, compares semantic similarity, and inserts semantic boundaries where the topic changes enough.

This can produce semantically coherent chunks for policies, wikis, academic papers, and long narrative documents where headings are weak or missing. A refund section stays separate from a shipping section even if somebody forgot to add a proper heading.

The downside is ingestion cost and tuning. You are doing semantic analysis before retrieval even starts, and thresholds that work for one domain may be rubbish in another. Test them. Do not pick 0.6 because an example notebook looked confident about it.

Contextual, Context-Aware and Context-Enriched Chunking

The terminology around contextual chunking is messy, so I separate two ideas.

  • Context aware chunking: uses surrounding content when deciding where a chunk should start and end. It is about preserving context across boundaries.

  • Context enriched chunking: adds context to the chunk itself, such as the document title, section heading, metadata, or a short summary before creating the embedding.

You will also see “aware chunking” used as shorthand for the first idea. In practice, context aware chunking can pull in a previous chunk, neighboring sentences, or a parent heading when a fragment would otherwise be ambiguous. Context enriched chunking helps the embedding model understand where the passage belongs in the wider document.

This is especially useful for legal, compliance, medical, and policy content where a sentence like “this applies for 30 days” is completely meaningless without knowing what “this” refers to. Context enrichment costs more at ingestion, but it can improve retrieval effectiveness when isolated chunks lose too much of the parent document.

Adaptive Chunking: Let the Content Change the Size

Adaptive chunking uses variable chunk sizes instead of one static rule across the entire corpus. Dense technical sections may become smaller chunks. Narrative sections can stay larger. Tables, lists, and code can follow specialized processing rules.

Good adaptive chunking techniques use signals such as heading depth, sentence length, content type, semantic density, or formatting. The chunking logic changes with the data instead of pretending every page has the same information density.

The obvious cost is complexity. Adaptive chunking can improve retrieval quality on mixed corpora, but it is harder to reproduce and debug than a simple deterministic splitter. Use it because your evaluation data earns the complexity, not because “adaptive” looks good in a diagram.

Agentic Chunking: Useful, Expensive, Easy to Overdo

Agentic chunking lets an LLM or agent choose a chunking strategy, inspect the document, set boundaries, enrich metadata, and sometimes refine the chunks after a first pass. It can be genuinely useful when one corpus contains radically different formats and domain rules.

It can also be a wonderfully elaborate way to spend money deciding where to put a line break.

I would reserve agentic chunking for high-value cases where simpler chunking strategies have measurable failure modes: mixed policy collections, complicated research corpora, contracts, or other content where the cost of missing context is much higher than the cost of extra processing. For ordinary help-center content, start simpler.

The Chunking Strategy Toolbox

Comparing Chunking Strategies: When to Use What

The appropriate chunking strategy depends on the document types, query patterns, domain stakes, and retrieval system around it. The table below is where I would start, not where I would stop.

Content type

Good starting strategy

Typical starting size

Watch out for

Support KB / FAQs

Paragraph + structure-aware

256–512 tokens

Tiny fragments that lose the actual answer

Technical manuals / API docs

Structure-aware + semantic

512–1,024 tokens

Splitting code, config, or related steps

Legal / compliance

Semantic + contextual

768–1,024 tokens

Exceptions separated from the rule

Code repositories

Structure-aware by function/class

256–512 tokens

Breaking atomic code units

Academic papers / research

Semantic or recursive

512–1,024 tokens

Losing section context or citations

Chat logs / tickets

Sentence/thread-aware

128–512 tokens

Breaking conversational turns

Mixed enterprise corpora

Adaptive + structure-aware

Variable

One strategy becoming a compromise for everything

Notice the word “starting.” The optimal chunking strategy is the one that wins on your data. A support team asking narrow product questions has a different retrieval problem from analysts searching large documents for multi-section evidence.

Which chunking strategy should I use? A simple decision tree for picking the right chunking approach

How Chunk Size Shapes Retrieval Metrics

Chunk size changes what your retrieval metrics are actually measuring. Smaller chunks can make exact facts easier to hit, but they may increase the number of candidates and reduce context preservation. Larger chunks may improve answer completeness while making similarity ranking less precise.

I would track at least three retrieval metrics while comparing chunking approaches:

  • Recall@k: did the relevant chunk appear anywhere in the top k results?

  • MRR: how high did the first useful result appear?

  • Hit rate: did retrieval find anything that actually contained the answer?

Then measure the final answer as well. Retrieval accuracy can improve while generation gets worse if the model receives a pile of tiny disconnected chunks. Conversely, a larger chunk can hurt ranking slightly but give the language model enough context to answer correctly. The RAG system's performance is the end-to-end behaviour, not one metric in isolation.

This is also where embeddings matter. A chunking strategy that looks good with one embedding model may behave differently with another. If you are changing embeddings too, my RAG embeddings guide covers how to evaluate that layer separately.

Design Chunking Experiments Around Real Questions

Testing chunking approaches on your actual data is non-negotiable. Please do not optimize a production knowledge base using three friendly questions you invented while writing the code. Real users have an extraordinary talent for phrasing the obvious question in the one way your demo never considered.

Keep the experiment boring and controlled:

1. Build an evaluation set. Use real or realistic questions, expected source documents, and cases that should return “I do not know.”

2. Choose a small set of variants. For example: fixed-size 256, fixed-size 512, structure-aware, semantic, and one contextual option.

3. Keep the embedding model constant. If you change chunking and embeddings at the same time, you learn absolutely nothing about which change helped.

4. Run the same queries. Retrieve the same top-k for every variant and keep filters and reranking consistent.

5. Measure retrieval and generation. Track recall, MRR, hit rate, answer correctness, groundedness, latency, and cost.

6. Inspect failures manually. Look for missing context, weak chunk boundaries, duplicate chunks, stale content, or relevant information split across multiple chunks.

Once you have a repeatable evaluation set, the question “what is the best chunking strategy?” becomes much less mystical. You can actually compare it instead of arguing about it.

Test Chunking, Don't Guess. How to compare chunking strategies properly

Pre-Chunking, Post-Chunking and Chunk Expansion

Most systems pre-chunk during ingestion: create chunks, embed them once, and store them in the index. It is cheap at query time and easy to reason about. The weakness is that those boundaries were chosen before you knew what the user was going to ask.

Post-chunking changes or refines content at query time. You might retrieve a larger section, extract the most relevant snippet, expand a small hit with neighboring chunks, or merge multiple chunks before generation. This adds latency, but it can recover sufficient context without making every stored chunk enormous.

Chunk expansion is one of my favourite compromises. Retrieve small, precise units; then pull ±1 neighboring chunks or the parent section when the answer clearly depends on surrounding context. Small chunks stay good for search, while the model receives a more coherent passage.

This is also where your vector database and retrieval layer matter. Metadata, parent IDs, ordering, and document references make expansion much easier than trying to reconstruct structure after the fact.

Tables, Code, Images and Other Content That Hates Naive Chunking

Some content should not be treated as ordinary prose. Tables, code, diagrams, and other structured documents carry relationships that disappear when you split them carelessly.

  • Code: keep functions, classes, configuration blocks, and other logical units intact. Splitting a function across two chunks is usually a fantastic way to retrieve code that cannot run.

  • Tables: preserve headers with rows and keep related values together. A cell without its column name is not meaningful context.

  • Images and diagrams: store captions, OCR text, alt text, or multimodal representations that the retrieval system can actually search.

  • Long PDFs: preserve page, heading, section, and source metadata so the relevant passage still knows where it came from.

The general rule is simple: if a content type has internal structure, preserve that structure during chunk creation. Treating everything as plain text because the pipeline happens to accept strings is convenient right up until retrieval starts failing.

Implementing Chunking Strategies in Production

Once chunking moves from a notebook into production, boring operational details become important. Overlap creates more chunks and more embeddings. Semantic chunking can require additional embedding work during ingestion. Context enriched chunking may add model calls. Changing the strategy can mean reprocessing a large corpus and rebuilding an index.

Version the configuration. Names like chunk-v1-fixed-512 and chunk-v2-structure-semantic are not glamorous, but they let you compare results, roll back safely, and understand which chunking logic produced a particular answer.

After deployment, I would monitor:

  • Total chunks and average chunks per document.

  • Average and maximum chunk size.

  • How often chunks hit embedding-model token limits.

  • Top-k retrieval accuracy and irrelevant top results.

  • How often answer failures trace back to missing context.

  • Tokens passed to the LLM, latency, and cost.

  • Whether users keep asking follow-up questions because the first answer was incomplete.

Roll out a new strategy against a small corpus first. Shadow it against production queries, compare the results, then switch traffic when the evidence says it is better. Chunking is part of the retrieval system, so treat changes like retrieval changes rather than a one-off preprocessing detail.

A Practical RAG Chunking Checklist

1. Start with the document structure you already have before inventing clever boundaries.

2. Pick two or three chunk sizes and test them rather than assuming one default is correct.

3. Keep headings, definitions, exceptions, tables, code blocks, and other atomic units together.

4. Use overlap or neighboring chunks when a boundary regularly strips away necessary context.

5. Compare fixed-size, structure-aware, and semantic chunking before adding more complex methods.

6. Use contextual chunking when isolated chunks lose the meaning of the parent section.

7. Use adaptive chunking only when variable content genuinely benefits from variable chunk sizes.

8. Reserve agentic chunking for cases where simpler approaches fail and the extra cost is justified.

9. Evaluate retrieval with real questions and keep the embedding model constant during chunking tests.

10. Version the chunking configuration so you can reproduce, compare, and roll back changes.

The Best Chunking Strategy Is the One Your Data Proves Works

There is no universal best chunking strategy. There are only different chunking strategies that make different trade-offs between retrieval precision, context preservation, cost, and complexity.

Start simple. Respect document structure. Test a few chunk sizes. Look at the retrieved chunks, not just the final answer. If the relevant chunk is missing, fix retrieval. If the chunk is present but missing an important exception, fix the boundaries or expand the context. If the evidence is good and the answer is still bad, then you can start looking downstream.

And if you are already deep into a RAG system and trying to work out why retrieval is still a bit rubbish, the RAG performance guide is the natural next step. It covers chunking alongside hybrid search, reranking, query rewriting, evaluation, latency, and the other knobs that actually move production quality.

Chunking is not glamorous. Neither is indexing. Neither is evaluation. Unfortunately, those boring pieces are usually what decide whether your expensive AI system finds the right paragraph or confidently explains the wrong one.

THE FETCH HIVE FIELD NOTES

Build better RAG systems.

Get practical lessons on retrieval, RAG architecture and better answers, alongside AI workflow guides from the Fetch Hive team.

Get Fetch Hive guides and occasional product updates. Unsubscribe anytime.

THE FETCH HIVE FIELD NOTES

Build better RAG systems.

Get practical lessons on retrieval, RAG architecture and better answers, alongside AI workflow guides from the Fetch Hive team.

Get Fetch Hive guides and occasional product updates. Unsubscribe anytime.

Share this post

THE FETCH HIVE FIELD NOTES

Build better RAG systems.

Get practical lessons on retrieval, RAG architecture and better answers, alongside AI workflow guides from the Fetch Hive team.

Get Fetch Hive guides and occasional product updates. Unsubscribe anytime.