RAG, short for retrieval-augmented generation, lets an AI model answer from your own documents. To make that work, each document is split into passages called chunks, which are embedded and stored so the system can retrieve the right ones for every question. That splitting step is chunking.
Here is a chunk from a financial filing: “The company’s revenue grew by 3% over the previous quarter.” Which company? Which quarter? A retrieval system that stored only that sentence cannot say, and neither can the model that receives it. Anthropic uses this exact example to show how chunks lose context.
That loss happens in the first step of every RAG pipeline, before any model runs, and the chunks are all the model ever sees. Chroma tested a popular default setting for cutting documents into chunks. It still found the right answers, but it sent the AI far more unneeded text than a simpler setup. That extra text costs money and can distract the AI. And most teams never change a default. You can do better by testing.
This article compares RAG chunking strategies by evidence, prices the options, and ends with a test you can run on your own documents. The argument is simple: choose the cheapest strategy that clears your accuracy bar.
If your system already returns the wrong passages, our technical audit for AI platforms is the fastest way to find out why.

Table of Contents
Key Takeaways
- What is chunking in RAG, and why does it affect answer quality? It splits documents into passages that an AI system embeds, searches, and reads, so retrieval accuracy and answer quality depend on how the cuts are made.
- How do embedding models and context windows limit chunk size? They cap how big a chunk can be and how many chunks the AI can read, and a knowledge base under 200,000 tokens (about 500 pages) can skip RAG.
- How do chunk size and overlap affect retrieval? No single size wins, so test 10 to 25% overlap, and add keyword search to vector search, which cut misses from 3.7% to 2.9% in one test.
- What are the main chunking strategies, and which one should you start with? The main types are fixed-size, recursive, sentence-based, and paragraph-based splitting. Start with recursive or sentence splitting, because fixed-size cutting scored lowest in a 36-strategy study.
- When are semantic, hierarchical, contextual, or LLM-based chunking worth it? Only where a test shows a gap in the simple methods. Contextual notes cut misses from 5.7% to 3.7%, while LLM-based chunking costs the most.
- How should you chunk PDFs, tables, and code? Get the parser right first, keep tables whole with their headers, and split code, Markdown, JSON, and HTML at their own boundaries.
- How does poor chunking cause hallucinations and wrong answers? The right passage is missed, arrives without context, or arrives buried in noise. Untested defaults are the most common mistake.
- Are platform defaults safe to keep? Not without a test. OpenAI’s default repeats half of each chunk, and Google Vertex AI repeats 25%, which can double the text you process.
- What does chunking cost to run and keep fresh? Embedding 10 million tokens costs cents, while storage, the AI calls made while loading documents, and re-indexing cost more, and updates need stable IDs and deletion tracking.
- How do you test and compare chunking strategies? Write 50 to 100 real questions, change only the chunker, score retrieval and answers separately, record cost next to quality, and re-run after any change.
What Is Chunking in RAG, and Why Does It Affect Retrieval Accuracy and Answer Quality?
A RAG system cuts each document into passages, embeds them, and retrieves the best matches for every question. Those passages are the only evidence the model sees, so retrieval accuracy and answer quality are capped by how the cuts were made. Barnett et al. describe the trade: if chunks are too small, some questions cannot be answered, and if they are too long, answers pick up noise.
In Anthropic’s tests, a standard search missed the right passage 5.7% of the time, even with 20 results returned. Adding a short note to each chunk about where it came from cut the misses to 3.7%. Adding exact-word matching cut them to 2.9%, and a second pass that re-sorts the results brought them to 1.9%.
Here is how that looks in our work.
For a national-curriculum education platform, Master of Code Global designed an AI tutor that answers students from the official textbooks for their grade and subject. The platform’s data model follows the curriculum’s own hierarchy of grade, subject, chapter, and topic, and the textbooks are chunked and indexed per grade and subject. When a student asks a question, a retrieval step pulls the chunks that match and combines them with the student’s learning history before the model is called.
Two design choices come straight from chunking risks. Each subject and grade gets its own vector index, so a query cannot pull passages from another subject, which the proposal calls context bleed. STEM textbooks also pass through a formula pre-processing step that normalizes mathematical notation, because an equation that extracts as garbled text becomes a garbled chunk.
A fallback handles retrieval that returns low-confidence chunks. As the project is scoped, not delivered, no outcome data exists yet.
How Do Embedding Models and Context Window Limits Shape Chunking?
Embedding models and context window limitations influence chunking strategy selection by capping how big a chunk can be and how many chunks the AI can read per question.
The first limit belongs to the embedding model, the tool that turns each chunk into a form the system can search. It can only read so much at once. Microsoft notes that Azure OpenAI embedding models stop at 8,191 tokens, around 6,000 words, so longer text has to be split before it is stored. The second limit is the AI model’s context window: the amount of text it can read for one question. The chunks you retrieve must fit inside it, and Barnett et al. note that this limit caps how many chunks you can pass on.
The embedding model also changes which setup works best. In Chroma’s test, one small model found 82.4 of every 100 relevant words when chunks of about 190 words repeated half of the previous chunk, against 77.1 without the repeat. A setup tuned for one model may not suit another, and Barnett et al. add that switching models means re-indexing: every chunk has to be embedded again.
Do Large Context Windows Make Chunking Unnecessary?
Only for small knowledge bases. Anthropic says a knowledge base under 200,000 tokens, about 500 pages, can go straight into the prompt with no RAG. Beyond that, trade-offs appear.
Google DeepMind found that models able to read very long inputs beat RAG on answer quality when given enough resources, but RAG is far cheaper. Sending each question to whichever option fits cut the cost by 65% for Gemini-1.5-Pro and 39% for GPT-4o. Another study found that models answer worse when the key passage sits in the middle of a long input, and that giving them 50 documents instead of 20 helped only slightly.
Reranking, a second pass that re-sorts the results, changes the decision too. Anthropic fetched 150 candidate passages, re-sorted them, and passed the best 20 to the model, at the price of one extra step per question. Test with and without it, because the best chunk size can move.
How Does Poor Chunking Lead to Missing Context, Wrong Answers, and Hallucinations?
Poor chunking causes missing context, inaccurate answers, and hallucinations in three ways:
- the right passage is never retrieved,
- it arrives without the context that gives it meaning, or
- it arrives buried in noise.
Barnett et al. catalogued seven failure points in RAG systems, and three trace back to chunks. The chunking causes below are our mapping.
| Failure point | Chunking cause | Earliest signal | Fix |
|---|---|---|---|
| Missed the top-ranked documents | A chunk mixes topics or lacks the identifier a query uses | Answer passage in the top 20 but not the top 5 | Smaller chunks, a re-sorting step (reranker), exact-word matching |
| Not extracted | Noisy or contradictory text surrounds the answer | Answer is in the context, model misses it | Tighter boundaries; add file name and chunk number to the context |
| Incomplete | Related facts sit in different chunks | Partial answers to multi-part questions | Search small chunks but send the larger section around them (parent-child retrieval) |
LLM hallucinations come from a model inventing content. A chunk-caused error is different: real but partial or wrong evidence reaches the model, and the answer sounds sure.
How Do Chunk Size and Overlap Change Retrieval Performance, and Should You Keep the Defaults?
No single chunk size wins. Results move with the model, the document type, and the question. Shaukat et al. tested 36 ways of cutting text across six subject areas and five embedding models. Chunks of flexible length (dynamic token sizing) won in biology, physics, and health, while grouping paragraphs won in legal and maths. NVIDIA’s benchmark found the best chunk size varied too: 1,024 tokens on a set of financial questions, 512 on earnings reports.
How Do Chunk Size and Overlap Affect Retrieval Performance?
Small chunks return less unneeded text, while bigger or overlapping ones keep more of the surrounding context. Teams find the optimal settings by testing a few chunk sizes and overlaps on their own questions.
Chroma measured recall, the share of the relevant text the system found, and precision, the share of the returned text that was relevant. Chunks of 200 tokens with no overlap reached 88.1 recall and 7.0 precision. The 800/400 setting, chunks of 800 tokens that each repeat the last 400 of the one before, reached 85.4 recall and 1.5 precision.
Overlap can still help. El Bachyr et al. tested how much of each chunk repeats the previous one (0%, 25%, and 50%) on financial PDFs, and scored how near the top the right passage ranked (1.0 means first place). For the best-performing chunker, neural chunking, the score reached 0.658 at 25%. At 50% it was 0.647, while the stored data doubled. NVIDIA found 15% worked best of the three values it tried (10%, 15%, and 20%) at 1,024 tokens, and Microsoft’s chunking guide suggests starting at 10% in one section and 25% in another. Test 10 to 25% chunk overlap first.
How Does Chunk Size Affect Vector, Keyword, and Hybrid Search?
Chunk size and granularity affect vector search, keyword search, and hybrid retrieval differently, because each rewards a different kind of chunk. Keyword search finds exact words, so it rewards chunks that keep a term, such as an error code, next to its context. Vector search matches meaning, so it rewards chunks that carry one idea.
Anthropic merges the two result lists, and adding exact-word matching to its context-note setup cut misses from 3.7% to 2.9%, so your retrieval stack needs both a vector database and a keyword (BM25) index. In El Bachyr et al., keyword search alone put the right page first 12.9% of the time on narrative questions and 57.6% on table questions.
Are Platform Defaults Safe to Keep?
Not without a test. The table shows what four platforms set, checked in each vendor’s docs on November 30, 2026. Sizes are in tokens unless marked; overlap share is the part of each chunk repeated.
| Platform | Chunk size | Overlap | Overlap share | Status |
|---|---|---|---|---|
| OpenAI file search | 800 tokens | 400 tokens | 50% | Default |
| Vertex AI RAG Engine | 1,024 tokens | 256 tokens | 25% | Default |
| Amazon Bedrock Knowledge Bases | About 300 tokens, sentence boundaries | Not stated | n/a | Default |
| Azure AI Search | 2,000 characters | 500 characters | 25% | Docs recommended start, text also cites 10% |
Chroma’s test, which used the OpenAI setting, found it among the weakest, because it returned the most unneeded text. Keep a default only after it beats an alternative on your questions.
What Are the Best Chunking Strategies for RAG?
No single strategy wins, and the evidence favors a plain baseline: recursive or sentence-based splitting, with structure-aware or contextual steps added only where a test shows a gap. The different chunking strategies in RAG differ in cost and in what they preserve, and the studies disagree. Shaukat et al. found paragraph grouping best of 36 methods, Qu et al. found semantic chunking’s gains inconsistent, and El Bachyr et al. found sentence chunking near-optimal and cheap.
How Do the Main Strategies Compare?
The main RAG chunking strategies are fixed-size, recursive, sentence-based, and paragraph-based splitting. This RAG chunking strategies comparison uses the findings above. nDCG@5 and MRR are ranking scores out of 1.0 that reward putting the right passage near the top.
| Strategy | How it splits | What the studies say | Skip it when |
|---|---|---|---|
| Fixed-size | Every N tokens or characters | Fixed character chunks scored under 0.244 nDCG@5 (Shaukat et al.) | Documents have structure |
| Recursive | Paragraph, then sentence, then word | Smallest index, about 2 chunks per page (El Bachyr et al.); 200 tokens performed well (Chroma) | Tables must stay whole |
| Sentence-based | Sentence boundaries, grouped | Second-best MRR in both benchmarks at low cost (El Bachyr et al.) | Answers span many sentences |
| Paragraph-based | One or two paragraphs | Best mean nDCG@5, about 0.459 (Shaukat et al.) | Text has no paragraph breaks |
How Does Semantic Chunking Work?
Semantic chunking turns each sentence into numbers that capture its meaning and cuts where neighboring sentences stop being similar. It rarely beats traditional text splitting by enough to justify the processing cost. Qu et al. found its gains inconsistent. In El Bachyr et al., it made about 5.8 chunks per page against 2.1 for recursive splitting and trailed sentence chunking by 0.045 on MRR (0.606 against 0.651) on FinanceBench.
How Does Structure-Aware Chunking Work?
Structure-aware chunking preserves document structure, headings, and metadata by cutting at boundaries the author already built: sections, pages, or tags. Jimeno Yepes et al. found that chunking by element type, such as titles and tables, improved RAG on financial reports.
What Are Hierarchical and Parent-Child Chunking?
Hierarchical, parent-child, and multi-granularity chunking store text at two or more sizes: small chunks are searched, and a larger parent goes to the model. Use them when users ask both precise and broad questions. Amazon Bedrock swaps retrieved child chunks for their parents, so it may return fewer results than requested.
How Does Contextual Chunking Beat Overlap?
Contextual chunking improves retrieval relevance compared to standard chunk overlap by adding a short note, written with the whole document in view, to each chunk before it is embedded. Overlap repeats neighboring words, and the note says what the chunk is about. Anthropic’s notes ran 50 to 100 tokens. Günther et al. take another route, late chunking: a model built for long texts reads the whole document first, so each chunk’s numbers already carry context, with no extra training.
When Is LLM-Based or Agentic Chunking Worth It?
LLM-based or agentic chunking is worth the additional complexity and cost only for small collections of high-value documents, where a test shows simpler methods missing answers. Chroma’s LLM chunker had the highest recall, finding 91.9 of every 100 relevant words, but its runtime ran to tens of minutes. El Bachyr et al.’s neural chunker led on MRR and made more than eight chunks per page, about four times the index of recursive splitting.
Chunking strategies in advanced RAG add AI calls while documents are loaded, so price them first. If an agent will act on the retrieved chunks, a wrong chunk can mean a wrong action, not just a wrong answer, so retrieval design belongs in the scope of any agentic AI development project from the start.
How Should You Chunk Different Types of Enterprise Content?
Document chunking strategies for RAG should follow the document type, and the parser, the tool that reads each file and pulls out its text, comes first. El Bachyr et al. found that pdfminer led on narrative text (MRR 0.646) and pdfplumber on tables (0.807), and that parser and chunker choices interact. Parsing and cleanup are AI data preparation work, and they decide what the chunker receives.
| Content | Start with | Add only if the test shows a gap | Watch out for |
|---|---|---|---|
| Technical knowledge bases | Recursive or heading-based splits | Parent-child retrieval | Headings separated from their body |
| Contracts and legal text | Paragraph groups, strongest in Shaukat et al.’s legal set | Context notes naming the parties | Clauses that cite other clauses |
| Financial reports | Page or element-based chunks | Context notes with company and period | Tables split from their headers |
| Tables and spreadsheets | Keep each table whole with its headers | Row groups with headers repeated | Flattened text that loses columns |
| Code, Markdown, JSON, HTML | Format-aware splitters | Chaining with a length-based splitter | Cuts inside a function or tag |
| Scanned PDFs | OCR first, then the rows above | Layout-aware parsing | Slow parsing at scale |
How Should Businesses Choose by Use Case?
Businesses should choose chunking strategies for legal documents, technical knowledge bases, and financial reports by asking three things: what the unit of meaning is (a clause, section, page, or table row), what questions users ask, and what a wrong answer costs. The table above gives the starting point for each.
What Works for Complex PDFs?
The best chunking strategies for complex PDFs, including multi-column layouts, tables, and embedded visuals, start with a parser that reads layout, then split by page or element. In El Bachyr et al., PyPDF2, the simplest parser tested, ranked last on both benchmarks. NVIDIA’s page-level chunking gave the highest average accuracy, 0.648 out of 1.0.
How Should Tables and Financial Documents Be Chunked?
RAG systems chunk tables, spreadsheets, and financial documents without losing relationships by keeping each table whole, with its headers, and parsing it as structure rather than flattened text. In El Bachyr et al.’s table benchmark, a word-by-word matching method put the right page first 76% of the time, against 57.6% for keyword search. Reading tables out of filings at scale is a project in itself, and our guide to Generative AI for document processing covers how that extraction works.
How Does Chunking Differ for Code, Markdown, JSON, and HTML?
Chunking strategies differ for code, Markdown, JSON, HTML, and other structured content because each format has its own natural cut points, and the best chunks follow them.
- Code: split by lines or functions, and repeat a few lines between chunks. LlamaIndex’s example code splitter uses 40 lines per chunk, repeats 15, and caps each chunk at 1,500 characters.
- Markdown: split at headings, so a heading stays with the text under it. Microsoft’s guide notes that heading syntax in Markdown and HTML can be used to chunk by sections.
- HTML: split by tags such as paragraphs, headings, and list items. LlamaIndex’s HTML parser reads a default set of tags (p, h1 to h6, li, b, i, u, section), and you can change the list.
- JSON: split along the structure of the data, not by length. LlamaIndex offers a parser built for this.
How Can RAG Handle Long Documents?
RAG systems handle long documents and information spread across multiple sections by pairing small searchable chunks with a way to recover surrounding context. Parent-child retrieval does this at query time. Late chunking does it at embedding time, though Günther et al. note that long-context embedding models accept around 8,192 tokens, roughly ten pages, so longer documents need extra handling.
What Does Chunking Cost to Build, Serve, and Keep Fresh?
Chunking costs far more in storage, AI calls while loading documents, and upkeep than in embedding fees.
How Do Strategies Change Cost, Storage, and Latency?
Different chunking strategies affect embedding costs, storage requirements, processing time, and retrieval latency mostly through two numbers: how many chunks you create and how many tokens you embed. The formula is chunks = tokens ÷ (chunk size − overlap): each new chunk adds only the part that is not repeated. Microsoft measured chunk counts for a 200-page PDF, and the formula matches within about 1%. Chunks of 2,000 characters with 500 repeated gave 113 chunks against 85 without the repeat, a ratio of 1.33, and the formula predicts 1.33.
The table applies it to a 10-million-token corpus. It is an illustrative model. The real figures are OpenAI’s prices of $0.02 and $0.13 per million tokens for its small and large embedding models, Microsoft’s counts, and each chunk saved as a list of 1,536 numbers at 4 bytes each, before any extra search-index storage.
| Size / overlap (tokens) | Chunks | Tokens embedded | Cost, small model | Cost, large model | Raw vectors |
|---|---|---|---|---|---|
| 400 / 0 | 25,000 | 10.0M | $0.20 | $1.30 | 0.15 GB |
| 512 / 50 | 21,646 | 11.1M | $0.22 | $1.44 | 0.13 GB |
| 800 / 400 (OpenAI default) | 25,000 | 20.0M | $0.40 | $2.60 | 0.15 GB |
The default embeds every token twice. At this scale, the fee is small, so the costs sit elsewhere. Contextual notes cost $1.02 per million document tokens under Anthropic’s stated assumptions, about $10.20 here, and must be regenerated for changed documents. Semantic and neural splitting multiply chunks by roughly three to four, an LLM chunker adds model calls, and reranking adds a step for every question. Tighter chunks also shrink the prompt the model must read, which is where LLM cost optimization starts.
As our CTO, Bogdan Sergiienko, wrote in The Economics of Agentic AI: “A smaller, well-tuned model that answers accurately in 400 milliseconds beats a slow, expensive flagship model.“
How Do You Handle Updates and Re-Chunking?
Production RAG systems manage document updates, versioning, and rechunking without disrupting retrieval by treating the index like a deployed release: stable IDs, change and deletion tracking, and a swap only after tests pass. In Azure AI Search, when a parent document changes, meaning the original file, every child chunk cut from it gets a new ID even if its text did not change, and a shorter document deletes the leftover chunks. Deleted source documents leave orphaned chunks unless a deletion policy was set from the first run.
Keep the old and new chunk sets in separate indexes or namespaces in your vector database until the new set passes your test. Freshness is the core promise of AI for knowledge management: an answer from a retired policy is worse than no answer.
If every source change forces a manual re-index, that is integration work, and our LLM integration services cover the sync and change tracking around your sources.
How Do You Test, Compare, and Keep Improving a Chunking Strategy?
Engineering teams evaluate and compare RAG chunking strategies by holding everything else fixed and scoring retrieval and answers on the same real questions. A practical framework for AI architects to select, test, and continuously optimize chunking has five steps.
- Write 50 to 100 real questions with the passages that answer them. Test data rarely exists for RAG, so generate it or pilot.
- Change only the chunker. Keep the parser, embedder, retriever, and prompt fixed.
- Score retrieval and answers separately. For retrieval, use recall (how much of the relevant text was found), precision (how much of what came back was relevant), and hit rate (how often the right passage shows up). For answers, add a human sample.
- Record cost next to quality. Log chunks, index size, ingestion calls, and latency for every strategy.
- Re-run after any change to the embedding model, parser, or documents. RAG chunking strategies optimization is a loop, as RAG systems need continuous calibration, with retrieval accuracy checked in operation.
What Mistakes Break Enterprise Chunking?
The most common chunking mistakes in enterprise RAG implementations are untested defaults, chunking before parsing works, one strategy for every file type, no re-index plan, and judging only by final answers. The RAG chunking strategies best practices catch each one early:
- Untested defaults. Signal: nobody can say why the numbers were chosen. Fix: run the default against one alternative.
- Chunking before parsing works. Signal: garbled text in retrieved chunks. Fix: read a sample of raw chunks first.
- One strategy for all files. Signal: strong on reports, weak on tables. Fix: split the test set by document type.
- No re-index plan. Signal: stale answers after a policy change. Fix: set document IDs and a deletion policy at launch.
- Judging by final answers only. Signal: fluent answers, wrong sources. Fix: score retrieval first.
How Do We Validate Chunking Before Building?
The same proposal shows how we validate chunking before building. It assumes official textbooks often extract as unreadable text or flattened images, so OCR with math reconstruction is the default pipeline, and a two-week spike ends in a go/no-go gate before any ingestion work. In week one, the team confirms the embedding model and chunking strategy against real textbook content and sets a retrieval-quality gate. If one subject-level index still produces hallucinations, per-section expert agents step in. The next step is the spike on real textbooks.
If you have the questions but not the engineering capacity to run the comparison, our LLM development services team can build and test the pipeline with you.
Frequently Asked Questions
Can One Knowledge Base Use Different Chunking Strategies for Different Documents?
Yes, because chunking runs at ingestion and each content type can take its own parser and splitter. Microsoft’s chunking guide maps different content shapes to different methods. Keep the same embedding model and metadata across them, because a new model means re-indexing everything.
How Many Chunks Should a RAG Pipeline Retrieve?
Start at 20 and test lower. Anthropic compared 5, 10, and 20 chunks and found 20 the most effective, with a re-sorting step (reranker) narrowing 150 candidates. Liu et al. found that 50 retrieved documents instead of 20 helped only slightly.
Should Chunk Boundaries Follow Pages, Sections, or Tokens?
Follow the structure the document already has. NVIDIA’s page-level chunking had the highest average accuracy across five datasets, and El Bachyr et al. found token, sentence, and recursive splitting within a few MRR points of each other. Use pages for paginated reports, sections for manuals, and tokens as a fallback.
Where Should You Start?
If you have no test set, write 50 questions with their answers before you touch a splitter. If you have one, change only the chunker, compare two or three RAG chunking strategies, including your platform’s default, and keep the cheapest one that clears your accuracy bar.
If your documents are not parsed cleanly yet, start with parsing and a test set. If you already have both, a short pilot can show which strategy clears your accuracy bar and what it costs to run. Our Generative AI development team builds and tests that pilot on your own files. Book a call, and we’ll scope it.