Skip to content

Chunking strategies for RAG: size, overlap, and when to skip

Chunking strategies decide where documents are cut before retrieval. What published tests say about chunk size, overlap, semantic chunking, and skipping it.

Published
Reading time
14 min read

In short

  • Chunking strategies decide where documents are cut before they are embedded, and the cut sets what a retriever can return. A sound default is recursive splitting on paragraph and sentence boundaries at 200 to 400 tokens with no overlap.
  • Overlap rarely earns its cost. In Chroma's 2024 evaluation, removing a 200-token overlap from 400-token chunks did not lower recall, and a 2026 study measured no gain in answer quality from overlap, which at 20% makes an index 1.25 times larger.
  • Semantic chunking's gains are inconsistent in published tests. It wins on documents stitched together from short, mixed-topic texts and ties or loses to fixed-size, sentence, and paragraph splitting on ordinary long documents.
  • Anthropic's contextual retrieval, which prepends model-written document context to each chunk, cut top-20 retrieval failures from 5.7% to 2.9% with keyword search and to 1.9% with reranking. A corpus that fits in a cached prompt needs no chunking at all.

Chunking strategies are the rules a retrieval system uses to cut documents into the pieces it embeds, indexes, and returns. In retrieval-augmented generation (RAG), where a model answers from passages fetched at request time, the cut decides what the model can be shown. A fact split across two chunks, or buried in a chunk about something else, is hard to retrieve however good the embedding model is.

The published evidence supports a plainer setup than most tutorials describe. Start with recursive splitting on paragraph and sentence boundaries, at 200 to 400 tokens, with no overlap. Follow the document's own structure where it has one. Add keyword search, a reranker, and document context for each chunk before trying cleverer boundaries. If the whole corpus fits in a cached prompt, do not chunk at all.

What chunking is for

Chunking does two jobs. It gives each embedding one idea to represent, and it sets the unit the retriever hands to the model. Fitting text into an embedding model's input limit, the original reason, matters less now. As of November 2026, most hosted embedding models accept whole documents.

Embedding modelMaximum input
OpenAI text-embedding-3-small and text-embedding-3-large8,192 tokens
Google gemini-embedding-28,192 tokens, and 2,048 for gemini-embedding-001
Voyage voyage-4 series32,000 tokens
Cohere embed-v4.0 and embed-v5.0128k tokens, and 512 for the v3 models

Embedding a whole document still retrieves worse than embedding its parts, because one fixed-size vector for ten pages averages everything on them. The late chunking paper from Jina AI measured this on four long-document tasks, with documents truncated to fit the model. Splitting into 512-token chunks improved nDCG@10, a ranking-quality score, by 24.47% on average over one embedding per document.

The second job limits chunk size from both ends. A chunk that is too large fills the model's context with text the question did not ask about. Chroma's 2024 evaluation scored retrieval token by token. With 800-token chunks and 400 tokens of overlap, about 1.5% of the retrieved tokens were relevant to the query, against 7% with 200-token chunks and no overlap.

A chunk that is too small loses the words that say what it is about. Anthropic's example is a chunk from a financial filing that reads "The company's revenue grew by 3% over the previous quarter." Neither the company nor the quarter is in the chunk, so neither is in its embedding.

The strategies, in order of effort

The seven strategies below run from cheapest to most expensive to build and run. The first four decide where to cut. The last three change what is returned or what is embedded, and work on top of any cut.

StrategyHow it worksAdded costPublished evidence
Fixed-size with overlapCuts every N tokens, repeating the end of each chunk in the nextOverlap enlarges the indexA workable baseline
Recursive splittingCuts at the largest separator that fits: paragraph, line, sentence, wordNoneWithin 3 points of Chroma's best recall
Document structureCuts at headings, pages, functions, and table edgesA parser per formatMatches or beats token windows
Semantic chunkingCuts where the embedding distance between neighboring sentences jumpsAn embedding call per sentenceInconsistent
Small-to-bigSearches small chunks and returns the passage each came fromA second store, more tokens per hitThin
Late chunkingEmbeds the whole document, then pools token vectors per chunkA long-context embedding modelGains in the original paper, mixed in a reproduction
Contextual retrievalPrepends model-written document context to each chunkA model call per chunk35% to 67% fewer retrieval failures
SECTION BREAKSECTION BREAKDocument## Setup## Configuration## LimitsFixed size500-TOKEN WINDOWS12345OVERLAP: IN BOTH CHUNKSBy structureCUT AT EACH HEADING300 TOKENS900 TOKENS600 TOKENSSmall-to-big100-TOKEN CHILDRENMATCHED ON ONE SMALL CHUNK · RETURNED: ITS WHOLE SECTION
One document under three cuts. Fixed-size windows ignore the section breaks, structural splitting follows them, and small-to-big searches small chunks but returns the matched chunk's whole section. Sizes are illustrative.

Fixed-size and recursive splitting are the baseline

Start with recursive splitting, because nothing more elaborate has beaten it consistently. Where fixed-size chunking cuts every N tokens, recursive splitting takes the same limit and tries separators in order: a paragraph break if the pieces fit, then a line break, then a sentence, then a word. LangChain's docs recommend its RecursiveCharacterTextSplitter for most use cases.

Chroma's evaluation is the most direct test. It ran 472 generated queries over five corpora, retrieved five chunks per query with OpenAI's text-embedding-3-large, and counted the relevant tokens that came back. Recursive splitting with no overlap recalled 89.5% at 400 tokens and 88.1% at 200. The best result in the table was 91.9%. Chroma added sentence punctuation to LangChain's default separators, because the defaults produced very short chunks.

The defaults you inherit are less consistent than the evidence.

ToolDefault chunk sizeDefault overlapCounted in
LangChain RecursiveCharacterTextSplitter4,000200Characters
LlamaIndex SentenceSplitter1,024200Tokens
OpenAI file search800400Tokens
Unstructured basic and by_title5000Characters

The first two rows are from library source as of November 2026, the others from vendor docs. Chroma tested OpenAI's default and found slightly below-average recall (87.9%) and the lowest precision in its table.

Why overlap is usually smaller than people set it

Set overlap to zero when chunks end on sentence or paragraph boundaries, and to 10 to 15% when they do not. Overlap repeats the end of one chunk at the start of the next, so a sentence cut by a boundary appears whole in one of them. It patches arbitrary cuts, and has little to fix once the cuts follow the text.

The tests that varied overlap mostly found no effect:

  • Chroma. Removing a 200-token overlap from 400-token chunks did not lower recall: 88.1% became 89.5% for recursive splitting, and 88.6% became 89.2% for fixed-size.
  • Chroma, with the smaller all-MiniLM-L6-v2 model. A 125-token overlap raised the fixed-size splitter's recall from 77.1% to 82.4% and left the recursive splitter's unchanged. Only the splitter that ignores sentence boundaries gained.
  • A 2026 study of question answering on Natural Questions. Overlap changed answer scores by less than the confidence intervals, and the authors recommend zero.
  • NVIDIA's 2025 test. Of 10%, 15%, and 20%, 15% did best on one dataset, in what NVIDIA notes was not a full grid search.

At an overlap ratio r, the index holds 1/(1 - r) times as many chunks: 1.25 times at 20%, and twice at the 50% of OpenAI's default. Adjacent chunks that share text match the same queries, so the top results repeat sentences and hold fewer distinct passages.

Splitting by document structure

Where a document has structure, cut on it. Headings in Markdown and HTML, pages in PDFs, and functions in code are boundaries the author drew around related sentences, and a parser recovers them without a model call. The cost is a parser per format and a fallback for long sections, because sections are uneven.

The usual pattern is to split on structure first, then run the recursive splitter inside any section over the size limit.

split.py
from langchain_text_splitters import (
    MarkdownHeaderTextSplitter,
    RecursiveCharacterTextSplitter,
)
 
# Pass 1: cut at headings. Each section keeps its heading path as metadata.
by_heading = MarkdownHeaderTextSplitter(
    headers_to_split_on=[("#", "h1"), ("##", "h2"), ("###", "h3")],
    strip_headers=False,
)
sections = by_heading.split_text(markdown_text)
 
# Pass 2: cap section length, counted in tokens, with no overlap.
by_size = RecursiveCharacterTextSplitter.from_tiktoken_encoder(
    encoding_name="cl100k_base",
    chunk_size=400,
    chunk_overlap=0,
    separators=["\n\n", "\n", ". ", "? ", "! ", " ", ""],
    keep_separator="end",
)
chunks = by_size.split_documents(sections)

Keep the heading path with each chunk, as metadata or as its first lines. A chunk that begins with its headings states its subject, which gives the embedding part of the context that later strategies pay a model to generate.

A 2026 reproduction study from the University of Queensland and CSIRO supports cutting on structure. Across six BEIR retrieval datasets and four embedding models, paragraph-based splitting had the highest average score for three of the models, and paragraph, sentence, and fixed-size splitting were typically within 1 to 3% of each other.

Semantic chunking: inconsistent gains

Semantic chunking is not worth its cost as a default: published comparisons show it winning on some kinds of document and tying or losing on most. The method embeds every sentence, measures the distance between neighbors, and cuts where the distance jumps. LlamaIndex ships it as SemanticSplitterNodeParser, after a proposal by Greg Kamradt. The cost is an embedding call per sentence at index time and chunk sizes you do not control: in Chroma's tests Kamradt's chunker, at its defaults, produced chunks averaging about 660 tokens.

  • Chroma. Kamradt's chunker had the lowest recall in the table, 83.6%. Chroma's own cluster-based chunker reached 91.3%, and one that asks GPT-4o where to cut reached 91.9%, against 89.5% for recursive splitting: a gain of about two points for embedding every 50-token piece or sending the corpus through a language model.
  • A 2024 study led by Vectara researchers. For document retrieval, a semantic chunker won on all six datasets built by stitching short documents together, which mixes topics inside each one. Fixed-size chunks won on all four datasets of ordinary long documents. For evidence retrieval, fixed-size chunks were best on three of five datasets, by small margins.
  • The Queensland reproduction. Semantic splitting and two LLM-guided methods trailed the simple methods for search across a corpus. The ranking reversed for search inside one long book, where an LLM-guided chunker beat paragraph splitting by 10 to 30%, at 1.11 documents per second against 1,854.
  • The Natural Questions study. Sentence and semantic chunking were statistically tied.

Semantic chunking finds topic changes, so it helps where topics change without a visible marker: transcripts, chat logs, and concatenated files. Where the author has already marked the changes with paragraphs and headings, a cheaper splitter finds the same boundaries.

Small-to-big: search small chunks, return the parent

Small-to-big retrieval separates the unit you search from the unit you return. Small chunks are embedded, because a narrow chunk makes a precise vector, and on a match the retriever returns the larger passage the chunk came from.

LangChain implements it as ParentDocumentRetriever, where the parent is the whole source document or a larger chunk. LlamaIndex has two versions. SentenceWindowNodeParser embeds single sentences and keeps three sentences on each side to swap in before generation. HierarchicalNodeParser builds chunks of 2,048, 512, and 128 tokens by default, and an auto-merging retriever swaps retrieved leaf chunks for their parent once enough of them match.

The cost is a second store, a lookup per match, and more tokens per result. Evidence is thin: LlamaIndex's own auto-merging example, run on questions generated from one paper, reports results roughly equal to its baseline retriever.

Small-to-big fixes what the model reads, not the small chunk's embedding, which still lacks the words that say what the chunk is about. In the Queensland study, single-fact chunks extracted by a language model scored 15 to 27% below paragraph chunks for corpus retrieval.

Late chunking and contextual retrieval: put the document back into the chunk

Both strategies repair the same failure, a chunk whose meaning depends on text outside it. Late chunking does it inside the embedding model. Contextual retrieval does it with a language model call per chunk.

Late chunking runs the whole document through a long-context embedding model, then averages the token vectors for each chunk separately, so every chunk's vector has seen the rest of the document. Across three embedding models and four BEIR datasets, the original paper reports nDCG@10 gains of 1.5 to 1.9 points over the same boundaries embedded separately. Jina's API for jina-embeddings-v3 exposes it as a late_chunking flag, limited to 8,192 tokens per request, and Voyage AI's voyage-context-4 takes a document's chunks in one request for the same purpose.

The Queensland reproduction is less favorable. Late chunking generally improved retrieval across a corpus and degraded it inside a single long document in every configuration, by about 4% to 53% depending on the model.

Contextual retrieval, published by Anthropic in September 2024, sends a model the whole document and one chunk, asks where the chunk fits, and prepends the 50 to 100 tokens it returns before embedding and BM25 keyword indexing. In Anthropic's tests, the share of relevant passages missing from the top 20 results fell from 5.7% to 3.7% with contextual embeddings, to 2.9% with contextual BM25 added, and to 1.9% with a reranker.

The cost is one model call per chunk, repeated whenever a document changes. Anthropic put it at $1.02 per million document tokens at the time, assuming 800-token chunks and 8,000-token documents, with prompt caching so that each document is read at full price once.

Two of the three steps in that result are not chunking. Keyword search catches exact identifiers such as error codes that embeddings blur, the weakness that also makes semantic caching risky, and a reranker reorders whatever the index returns. Add both before changing a splitter.

Late chunking is the cheaper experiment where a provider offers it, but the Queensland result suggests it can hurt when most answers sit inside one long document. Use contextual retrieval when misses trace back to chunks that lack context and you can afford the calls.

Tables, code, and PDFs

Tables, code, and PDFs break text splitters, and each has a structural fix.

  • Tables. A table cut between rows leaves the second chunk with numbers and no column names. Keep each table as one chunk, and if it is too long, split it by rows and repeat the header row in every piece. Unstructured's chunker always isolates a table as its own chunk.
  • Code. Cut at function and class boundaries. LangChain's RecursiveCharacterTextSplitter.from_language swaps in per-language separators, and LlamaIndex has a CodeSplitter. The cAST paper chunks along the syntax tree instead of by line count and reports gains of 4.3 points in Recall@5 on RepoEval and 2.67 points in Pass@1 on SWE-bench.
  • PDFs. Extraction comes first, because a splitter cannot repair text that came out in the wrong reading order. After that, the page is a sound unit. NVIDIA compared token-based, section-level, and page-level chunking on five datasets, and page-level chunks had the highest average answer accuracy (0.648, against 0.603 to 0.645 for token sizes from 128 to 2,048). The margin is small, and 1,024-token chunks were ahead on FinanceBench.

When to skip chunking

Skip chunking when the whole corpus fits in the prompt, changes rarely, and is needed by most requests. Anthropic's contextual retrieval post says a knowledge base under 200,000 tokens, about 500 pages, can go into the prompt whole, with prompt caching to cut the cost of rereading it.

The price is that every request reads the full corpus, at cached rates only while the prefix is unchanged, and each edit to the corpus invalidates the cache from that point on. Accuracy falls as input grows, so run a length sweep on your own task before committing. RAG vs fine-tuning compares long context against retrieval, and context engineering covers where a preloaded corpus goes in the window.

Documents that are already chunk-sized, such as FAQ entries and support tickets, need no chunking either. Embed each one whole.

How to choose: change one thing and measure recall

Choose by measurement on your own queries, because the studies above disagree across corpora, embedding models, and tasks.

  1. Collect 50 to 100 real questions. For each, mark the answering text by its position in the source document, not by chunk ID, because chunk IDs change every time you re-chunk. RAG evaluation covers the labeling, and LLM evaluation the question set.
  2. Index with the baseline: recursive splitting, 400 tokens, no overlap. Record recall at k, the share of questions whose answer text is inside the top k chunks, and the tokens returned per query.
  3. Change one thing, re-index, and rerun. Try chunk size first (200 and 800), then structural cuts, then keyword search with a reranker, then late chunking or contextual retrieval. Try semantic chunking last.
  4. Keep the change only if recall moves by more than the noise. In Chroma's results the standard deviation of per-query recall was about 30 points, so compare the same questions before and after and ignore a one-point difference over 100 questions.

Watch tokens per query alongside recall, because a change that raises recall by two points and triples the text sent to the model trades a retrieval problem for context rot.

Frequently asked questions

What is chunking in RAG?

Chunking is the step that splits source documents into smaller passages before they are embedded and indexed for retrieval. Each chunk gets its own embedding, and the retriever returns chunks, not whole documents. The boundaries decide which text can be found for a query and how much unrelated text comes back with it.

What is the best chunk size for RAG?

No single size is best. Chroma's 2024 evaluation found recursive chunks of 200 to 400 tokens close to the best recall. A 2025 multi-dataset study found 64 to 128 tokens best for short factual answers and 512 to 1,024 where answers need broader context. Start at 400 tokens and test 200 and 800 on your own queries.

How much chunk overlap should I use?

Use none when chunks end on sentence or paragraph boundaries, and 10 to 15% when a splitter cuts at fixed token counts. In Chroma's tests, removing a 200-token overlap from 400-token chunks did not lower recall. Overlap also enlarges the index: 20% overlap produces 1.25 times as many chunks.

Is semantic chunking better than fixed-size chunking?

Not consistently. A 2024 study led by Vectara researchers found semantic chunking ahead only on documents stitched together from short ones, and fixed-size chunks ahead on ordinary long documents. Reserve it for text with no structural markers, such as transcripts.

What is the difference between late chunking and contextual retrieval?

Both add document context to each chunk's embedding. Late chunking embeds the whole document with a long-context embedding model and pools token vectors per chunk, with no extra model calls. Contextual retrieval has a language model write a short context for each chunk and prepends it before embedding and keyword indexing, at a model call per chunk.

Do large context windows make chunking unnecessary?

Only for a small, stable corpus. Anthropic suggests putting a knowledge base under 200,000 tokens straight into the prompt, with prompt caching to cut the cost. Larger or fast-changing corpora still need retrieval, because every request would read the whole corpus and accuracy falls as input grows.

Sources

  1. 01Evaluating Chunking Strategies for RetrievalChroma Research
  2. 02Introducing Contextual RetrievalAnthropic
  3. 03Late Chunking: Contextual Chunk Embeddings Using Long-Context Embedding ModelsarXiv:2409.04701
  4. 04Is Semantic Chunking Worth the Computational Cost?arXiv:2410.13070
  5. 05Beyond Chunk-Then-Embed: A Comprehensive Taxonomy and Evaluation of Document Chunking Strategies for Information RetrievalarXiv:2602.16974
  6. 06A Systematic Analysis of Chunking Strategies for Reliable Question AnsweringarXiv:2601.14123
  7. 07Finding the Best Chunking Strategy for Accurate AI ResponsesNVIDIA Technical Blog
  8. 08Text splitter integrationsLangChain docs
  9. 09Node parser modulesLlamaIndex docs
  10. 10RetrievalOpenAI API docs
  11. 11ChunkingUnstructured docs