RAG Chunking Strategies That Change Results
For most RAG systems, start with recursive splitting at roughly 200 to 400 tokens with little or no overlap, split along the document's own headings where they exist, and add a sentence of document context to each chunk before embedding. Published evaluations show these plain choices matching or beating semantic chunking, which costs more to run.
Chunking is the step where documents are cut into the pieces a retriever can return. It gets less attention than model choice, yet it decides what the model is allowed to see. A chunk that splits a table from its heading, or an answer from the sentence that names its subject, cannot be repaired later in the pipeline. This post covers the five strategies worth knowing, what independent evaluations measured, and a way to test chunking on your own questions.
It assumes you know what retrieval-augmented generation is. If not, RAG vs fine-tuning covers the basics.
What are the main chunking strategies?
The five chunking strategies in common use are fixed-size, recursive, document-structure, semantic and contextual chunking. They differ in where they place boundaries and in how much computation they need at indexing time.
| Strategy | Where it cuts | Indexing cost | Good default for |
|---|---|---|---|
| Fixed-size | Every N tokens | Lowest | Logs, transcripts, uniform text |
| Recursive | Paragraph, then sentence, then word, up to a size limit | Low | Prose without reliable structure |
| Document-structure | Headings, tags, functions, JSON objects | Low | Markdown, HTML, code, manuals |
| Semantic | Where embedding similarity between sentences drops | Embedding call per sentence or group | Mixed-topic text with no headings |
| Contextual | Any of the above, plus generated context per chunk | One model call per chunk | Corpora where chunks lose their subject |
Fixed-size chunking counts tokens and cuts. It is fast and predictable, and it will cut through the middle of a sentence.
Recursive chunking tries larger units first. The LangChain text splitter documentation describes its recursive splitter as keeping paragraphs intact where possible, moving down to sentences and then words only when a unit exceeds the chunk size, and recommends it as the starting point for most use cases.
Document-structure chunking uses the format itself: Markdown headers, HTML tags, JSON objects, or functions and classes in code. The same LangChain page lists these and notes that structure often groups related text naturally.
Semantic chunking embeds sentences and places a boundary where neighbouring sentences stop being similar. Contextual chunking is not a way to cut; it is an addition to any cut, described below.
Does semantic chunking beat simple splitting?
Published evaluations do not show semantic chunking beating simple splitting consistently. The clearest statement comes from a 2024 study by Vectara researchers, Is Semantic Chunking Worth the Computational Cost?, which tested semantic against fixed-size chunking on document retrieval, evidence retrieval and answer generation. Its abstract concludes that the computational costs of semantic chunking "are not justified by consistent performance gains".
Chroma's technical report, Evaluating Chunking Strategies for Retrieval (July 2024), is more favourable but points the same way. Scoring retrieval at the token level with five retrieved chunks and OpenAI's text-embedding-3-large, it found:
- Chunking choice moved recall by up to 9% between strategies.
- A recursive splitter at 400 tokens with no overlap reached 89.5% recall. The same splitter at 800 tokens with 400 overlap reached 85.4%.
- The best recall, 91.9%, came from a chunker that asks an LLM where to split; a clustering-based semantic chunker reached 91.3%.
- A recursive splitter at 200 tokens with no overlap was, in the authors' words, consistently high performing across all metrics.
So the most elaborate method beat a well-set recursive splitter by about two and a half points of recall. The report also says it did not account for run time, which for the LLM chunker could reach tens of minutes. On most client projects that gap is smaller than what I can get from fixing extraction or adding hybrid search, so recursive or structure-based splitting stays my default.
What chunk size and overlap should you start with?
Start with chunks of roughly 200 to 400 tokens and little or no overlap, then adjust from measurements. That starting range comes from the Chroma report above, where smaller recursive chunks without overlap scored well on both recall and efficiency.
Two findings from that report are worth carrying into any project:
- Large chunks with heavy overlap are a weak default. Chroma evaluated the 800-token, 400-overlap setting that OpenAI's Assistants file search documented as its default, and observed slightly below-average recall and the lowest scores on every other metric.
- Overlap has a cost. Overlapping chunks repeat text, so more of what you retrieve is redundant. Chroma notes that reducing overlap improves its efficiency metric because that metric penalises redundant information.
Size also interacts with how many chunks you pass to the model. Anthropic's contextual retrieval write-up tested passing 5, 10 and 20 chunks and found 20 the most effective of the three in its experiments. Smaller chunks let you pass more distinct passages in the same token budget.
None of these numbers is a law. They come from specific corpora and embedding models. Treat them as a first setting to beat.
What is contextual chunking, and is it worth the cost?
Contextual chunking adds a short, generated description of where a chunk sits in its document to the front of the chunk before it is embedded and indexed. It addresses the most common chunking failure: a passage such as "revenue grew by 3% over the previous quarter" that no longer says which company or which quarter.
Anthropic published the method in September 2024 as contextual retrieval. A model reads the whole document and the chunk, and writes 50 to 100 tokens of situating context. In Anthropic's tests, contextual embeddings reduced the top-20 retrieval failure rate by 35% (from 5.7% to 3.7%), and combining them with a contextual BM25 keyword index reduced it by 49% (to 2.9%). Adding a reranker brought the reduction to 67% (1.9%). Keyword search and reranking are separate additions to the pipeline; the point here is that the context step alone removed about a third of the failures.
The cost is one model call per chunk at indexing time. Anthropic estimated a one-time cost of $1.02 per million document tokens using prompt caching, under its stated assumptions of 800-token chunks and 8,000-token documents. The same write-up reports that attaching a generic document summary to each chunk gave very limited gains, so the context needs to be specific to the chunk.
A related idea avoids the model call. Late chunking, by Michael Günther and colleagues, runs the whole document through a long-context embedding model first and splits into chunks afterwards, just before pooling, so each chunk's vector carries information from the surrounding text. It needs an embedding model that supports it.
How do you test chunking on your own documents?
Test chunking by holding everything else fixed and scoring retrieval on questions whose answer passages you have marked. The procedure takes an afternoon for a small corpus:
- Write 30 to 50 questions real users would ask, including a few that need a table, a list or a definition.
- For each question, mark the exact text spans that answer it. Spans, not chunk IDs, so the labels survive re-chunking.
- Index the corpus under two or three chunking settings with the same embedding model.
- For each setting, retrieve the top results and measure what share of the marked spans came back.
- Read the failures. Missing spans usually show a pattern: split tables, orphaned headings, or chunks without a subject.
- Change one thing and re-run.
Step 2 is what makes the comparison fair, and it is the idea behind Chroma's token-level scoring. Step 5 is where most of the improvement comes from. In my experience the fix is often upstream of chunking: a PDF extractor that flattens tables or drops headings will defeat any splitter.
Once you have the question set, keep it. The same set later becomes the retrieval half of a full evaluation of the system, and it is the fairest way to compare stores when you run a vector database comparison. It applies equally when an agent decides what to retrieve, as described in agentic RAG.
Work with me
I build and tune retrieval pipelines for product teams, remotely from India, starting from a test set made of your own questions. See AI integration and AI chatbot development, or browse my work and book a scoping call.
Frequently asked
Should chunks overlap?
A small overlap can protect sentences that straddle a boundary, but heavy overlap mostly adds duplicate text to your results. Chroma's evaluation found settings without overlap scoring well, so I start at zero or a few dozen tokens and increase only if failures show answers being cut at boundaries.
Does a long context window make chunking unnecessary?
For a small corpus, sometimes. Anthropic notes that a knowledge base under about 200,000 tokens can go straight into the prompt with no retrieval. Beyond that size you still need to choose what the model sees, and chunking decides the units you choose from.
How should tables and code be chunked?
Keep each table or function whole and attach its heading or signature. Structure-based splitters do this for Markdown, HTML, JSON and code. A table cut in half by a token counter loses its column headers and is close to useless when retrieved.
Do I need to re-embed everything when I change chunking?
Yes. New boundaries mean new text per chunk, so every chunk needs a new embedding. That is why it pays to test settings on a sample of the corpus first and index everything only once the choice is made.
Sources
Related services
Building something like this?
Naman Gundaniya takes on full-stack and AI projects: fixed quote after a free 30-minute scoping call, replies within 24 hours.
Get in touch