What you will be able to do
- Run a re-chunking experiment that changes one thing at a time against a fixed evaluation set
- Rule out chunk sizes that the embedding model or LLM context window cannot handle
- Map a recall drop or precision drop to a specific chunk-boundary problem and the change that fixes it
- Pick a production chunking strategy from DCG@10 and its confidence intervals
- Rule out the corpus, parsing, the embedding model, the query or the prompt before blaming chunking
Key concept
Evaluation-driven chunking selection — Each chunking strategy is a hypothesis. You test it by re-chunking and re-indexing the same corpus, running the same evaluation queries and judge, and keeping whichever strategy measurably improves retrieval. The choice comes from those metrics, not from a default or a rule of thumb.
1.The re-chunking loop: baseline, one change, re-index, compare
Chunking decides what the retriever can return. That makes it one of the first places to tune a RAG application, and also one of the easiest to tune blind. No chunk size or method is right for every corpus. You find out what works for your documents by trying candidates and measuring them. In practice the candidates are the Chunking strategy families (fixed-size, paragraph/recursive, format-specific, semantic), plus different sizes and overlaps within each family. Evaluation decides between them.
Set up evaluation before you change anything. You need a reproducible set of queries. It can be an existing golden dataset of labelled query-answer pairs, a synthetic set generated from your own documents, or a ground-truth-free setup that uses LLM judges. The set doesn't have to be perfect. It has to stay the same across runs, so that a change in the score reflects a change in the pipeline and not a change in the test.
From there the loop has four steps:
- Measure the current pipeline and record its retrieval metrics as the baseline.
- Re-chunk the corpus with exactly one change: a new strategy, a new size or a new overlap.
- Re-embed and re-index the new chunks. The index only contains vectors of the old chunks, so you can't evaluate a new strategy against it.
- Run the same queries with the same judge and compare against the baseline.
Change one thing per run. In a RAG system, changing one part has knock-on effects elsewhere. If you change chunk size and the embedding model in the same run and quality improves, you can't tell which change helped.
# Common configurations to test
small_chunks = 256 # Better for precise fact retrieval
medium_chunks = 512 # Balanced approach
large_chunks = 1024 # More context per chunkCheckpoint 1 of 8· Check yourself
A team records a baseline DCG@10 for their RAG retriever. In the next run, they switch from 256-token to 512-token chunks and also swap in a different embedding model. Then they re-index and run the same evaluation queries with the same judge. DCG@10 goes up. What can they conclude?
Changing one part of a RAG system has knock-on effects on the others. When two things change in the same run, the improvement can't be credited to either one. Each run should change a single variable compared with the baseline.
“Adjusting any single element can have cascading effects on the others.”Source: docs.databricks.com
2.Model limits that rule out a chunk size
Two models put hard limits on chunk size, so check them before you compare scores. The first is the embedding model. Every embedding model has a maximum number of input tokens. bge-large-en-v1.5, for example, accepts 512.
Truncation fails silently, and later stages can't undo it. A query about something in the last 1,300 tokens of that 1,800-token chunk has nothing to match, because that text never became part of a vector. A larger embedding batch size only changes how many chunks go in each call; every chunk is still cut off. A re-ranker only reorders candidates that retrieval already found, so it can't bring back text that was never embedded. The fix is in chunking: set a target size that reliably fits under the token limit. When the source has long paragraphs with no other breaks, use recursive splitting so that oversized paragraphs are broken down further.
The second limit is the LLM's context window. The retriever returns several chunks per query, and all of them have to fit in the prompt together. Large chunks combined with a high chunk count can run out of room. So the context window sets an upper bound on chunk size even when the embedding model would accept larger chunks.
Checkpoint 2 of 8· Check yourself
Retrieval keeps missing facts that appear late in long policy sections. The pipeline produces chunks of about 1,500 tokens, and the embedding model accepts at most 512 input tokens. Which change addresses the cause?
Text past the 512-token limit is truncated before it is embedded, so the late facts never become part of any vector. Only smaller chunks fix this. Batch size, re-ranking and a different splitter with the same size target all leave the truncation in place.
“If you pass chunks that exceed this limit, they will be truncated, potentially losing important information.”Source: docs.databricks.com
Checkpoint 3 of 8· Exam question
A team is preparing chunks for an embedding model whose maximum input context length is 512 tokens; any input beyond that length is truncated before it is embedded. Their current chunking pipeline splits only on double newlines between long, unstructured paragraphs, producing chunks that average 1,800 tokens. Which change should the team make to the chunking strategy so the embedding step reflects the full content of each chunk?
Correct answer: B — Split long paragraphs recursively by sentence and then word, capping chunks at about 450 tokens, so each chunk fits the model's input window.
- A. Sentence boundaries give cleaner cut points, but chunks that still average about 1,800 tokens exceed the 512-token input limit. Everything past the first 512 tokens is still truncated before embedding.
- B. Recursive splitting breaks the long, unstructured paragraphs into smaller pieces. Capping chunks at about 450 tokens leaves headroom under the 512-token limit, so no chunk is truncated and the embedding reflects its full content.
- C. Overlap repeats only a small slice of text. Each 1,800-token chunk is still cut at 512 tokens, so most of its content is never embedded, and the repeated 200 tokens cover only a small part of what is lost.
- D. Re-ranking runs after retrieval, on chunks whose embeddings were already computed from truncated text. The lost content never influenced which chunks were retrieved, so re-ranking cannot restore it at the embedding step.
3.Turning recall and precision drops into chunk-boundary fixes
Retrieval metrics show which way chunk boundaries are off. As a one-line recap of Precision@k and recall@k: recall measures how many of the known relevant documents were retrieved, and precision measures how many of the retrieved results are relevant. Chunk size moves the two in opposite directions. Small chunks focus on details but lose their surrounding context. Large chunks keep context but bring in unrelated text.
| What the metrics show | Likely chunking cause | Change to test next |
|---|---|---|
| Recall drops: relevant material is missing from the top-k | Chunks are too small, or boundaries split one idea across two chunks | Split on the document's own structure, or add overlap between adjacent chunks |
| Precision drops: retrieved chunks are mostly off-topic | Chunks are too large or noisy, so one chunk covers several subjects | Use smaller or more semantically coherent chunks |
| Retrieved chunks hold half of the answer | A fixed token count cuts through a logical unit | Use format-specific splitting on headers, so that each unit is one chunk |
Take a legal-contract assistant that chunks at a fixed 500 tokens with no overlap. Evaluation shows the retriever often returns only half of a relevant clause, because the token count ignores where clauses start and end. The contracts have consistent headers such as "4.2 Termination". That structure already marks the right boundaries, which is what format-specific chunking is for. Splitting on section and clause headers gives one complete clause per chunk.
The other likely fixes miss the cause. Cutting fixed chunks to 250 tokens still ignores clause boundaries, so it produces more broken clauses, not fewer. Raising k from 5 to 10 is a retrieval parameter in the chain. It might pull in the other half of a clause, but it also adds more irrelevant chunks to the prompt, and the boundary problem is still there. Semantic chunking infers boundaries from topic shifts. When the document already has explicit headers, inferring boundaries throws away information that is right there in the text.
Checkpoint 4 of 8· Match them up
An evaluation run turns up each of these retrieval symptoms. Match each symptom to the chunking cause it most likely points to.
Tap a term, then the definition that fits it.
Chunk size pulls recall and precision in opposite directions. Small chunks lose context and large ones bring in unrelated text. Half-clause results come from fixed-size splits that ignore logical boundaries. Facts lost late in a chunk point to truncation at the embedding model's token limit.
“Smaller chunks may focus on specific details but lose some surrounding contextual information. Larger chunks may capture more context but can include irrelevant information”Source: docs.databricks.com
Checkpoint 5 of 8· Exam question
A team building a RAG assistant over a corpus of legal contracts is currently using fixed-size, token-count chunking (500 tokens, no overlap). Retrieval evaluation shows that many chunks split individual contract clauses across two consecutive chunks, so the retriever often returns only half of a relevant clause. The contracts have clear, consistent section and clause headers (e.g., "4.2 Termination"). Which change to the chunking strategy is most likely to fix this specific issue?
Correct answer: C — Split each contract at its numbered section and clause headers, such as 4.2 Termination, and embed the text under each header as a separate chunk.
- A. Halving the token budget still cuts the text at a fixed count, regardless of where a clause begins or ends. It adds more boundaries, so more clauses are split, and the 500-token chunks were not exceeding the embedding model's limit anyway.
- B. A larger top-k changes how many chunks are retrieved, not where the chunks are cut. Clauses stay split in the index, the matching half can still rank low, and the prompt fills with extra chunks that add noise and cost.
- C. The contracts have clear, consistent clause headers. Cutting at those headers makes the chunk boundaries follow the document's real structure, so a chunk holds a whole clause and no longer ends partway through one.
- D. Embedding-similarity breakpoints follow topic drift between sentences, not the contract's numbering. A clause that moves between sub-topics can still be cut in two, and the consistent headers that mark exact clause limits go unused.
4.Choosing a strategy with DCG@10 and confidence intervals
For a single number that compares strategies, use DCG@10. It combines how relevant the results are with where they appear in the ranking, using a graded 0–3 relevance score from an LLM judge. Each result adds a gain of 2^relevance − 1, so a score-3 result adds 7 and a score-1 result adds 1. That gain is discounted logarithmically by position, so the first result counts in full and the tenth counts for much less. Higher is better. A list where every result scores 2 gets 13.63 out of a possible 31.80, and at that level a 1-point gain is about a 7% relative improvement.
Semantic chunking. Every run used the same queries and judge, so the scores are directly comparable. DCG@10 includes both relevance and ranking position, so 7.3 means its results are both more relevant and placed higher in the top 10. Cost-based or "bigger is always better" arguments don't override a clear quality result, and saying DCG ignores position gets the metric backwards.
The selection rule is: choose the strategy with the highest primary metric, but only if the gap is real. Every metric comes with a 95% confidence interval computed over the per-query scores. If the intervals separate, the winner is real. If they are wide and overlap, the set has too few queries to compare reliably, so add evaluation queries before deciding. The winner also has to meet your latency targets. If recall matters most, as in RAG where a missing chunk produces an incomplete answer, compare on recall@k as well as DCG@10. Use the other metrics too, because no single metric tells the whole story. Two strategies can have the same average relevance with very different distributions.
Checkpoint 6 of 8· Check yourself
Two chunking strategies are scored on the same queries with the same LLM judge. Strategy A gets a DCG@10 of 6.2 and strategy B gets 6.8. Both 95% confidence intervals are wide and overlap heavily. What should happen next?
Wide, overlapping confidence intervals mean the evaluation set has too few queries to separate the two strategies, so the 0.6-point gap may not be real. Enlarge the query set and compare again. A higher score only picks the winner once the intervals separate.
“Wide confidence intervals | Not enough queries for reliable comparison. | Increase the number of evaluation queries.”Source: docs.databricks.com
Checkpoint 7 of 8· Exam question
A team runs a retrieval quality evaluation across three chunking strategies applied to the same product-manual corpus: 200-token fixed-size chunks, 400-token fixed-size chunks, and semantic chunking that groups sentences by topic. Using the same generated test queries and LLM-judge relevance scoring for all three, the evaluation reports DCG@10 scores of 4.1, 5.0, and 7.3 respectively. Based on this evaluation, which chunking strategy should the team select for production, and why?
Correct answer: C — Choose semantic chunking, because it posted the top DCG@10 of the three at 7.3, so its chunks were judged more relevant and ranked higher among the top ten results.
- A. The gain from 200 to 400 tokens does not carry over to the comparison with semantic chunking. Semantic chunking scored 7.3 against 5.0 on the same queries and the same judge, so predictability of fixed windows does not justify choosing the lower-scoring strategy.
- B. The team is choosing based on retrieval evaluation results, and the 200-token strategy scored lowest at 4.1. Focused chunks are only valuable if they produce better ranked results, and the measured scores show they did not, so the precision argument cannot override the evidence.
- C. DCG@10 rewards relevant results and discounts them by rank position within the top 10. Semantic chunking scored 7.3 against 4.1 and 5.0 on identical queries and judging, so it returned more relevant chunks in better positions. That makes it the best choice.
- D. All three strategies were scored on the same generated queries with the same judge, so their raw DCG@10 values are directly comparable without normalisation. Cost alone cannot decide when the evaluation shows a clear quality gap of 7.3 versus 4.1 and 5.0.
5.Is chunking really the cause?
Bad answers don't automatically mean bad chunks. A RAG application can answer poorly even when retrieval found the right context, and it can answer well from poor retrieval. Measure retrieval and response quality separately. If the retrieved chunks are relevant and sufficient but the answer is still wrong or ungrounded, the problem is on the generation side: the prompt or the LLM. Re-chunking won't fix that.
Retrieval quality depends on more than chunking. On the data side, the corpus may not contain the answer, or parsing may have mangled it. A PDF that lost its tables during parsing will retrieve badly however it is chunked. On the chain side, the user's query may need rewriting, or the number of retrieved chunks may be wrong. Several fixes often matter more than fine-tuning chunk size: better parsing, metadata extraction for filtering, and adding document summaries or section headers to chunks.
Comparing search modes points at the embedding model. If full-text search clearly beats approximate nearest-neighbour (ANN) search on the same chunks, the embeddings probably don't capture your domain well. The next experiment is fine-tuning the embedding model or switching to full-text or hybrid search, not a new chunk size. Blame chunking when the corpus contains the answer, parsing is clean, embeddings hold up against keyword search, and the metrics show the boundary symptoms covered earlier: missing halves, truncated chunks, or noisy oversized chunks.
Checkpoint 8 of 8· Match them up
Before you re-chunk anything, you compare retrieval and response metrics separately. Match each evaluation finding to the part of the RAG application you should change next.
Tap a term, then the definition that fits it.
Retrieval and generation fail independently, so good chunks can still produce bad answers. Low scores across every strategy point to the data that all of them share. Full-text beating ANN points to the embeddings. Only boundary symptoms on clean, complete data point to chunking.
“A RAG application can respond poorly despite retrieving the correct context; it can also provide good responses based on faulty retrievals.”Source: docs.databricks.com
Sources
(6)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/quality-data-pipeline-ragOfficial docs
“Finding the proper chunking method is both iterative and context-dependent.”
↩︎ The re-chunking loop: baseline, one change, re-index, compare“making it one of the first layers of optimization in an RAG application”
↩︎ The re-chunking loop: baseline, one change, re-index, compare“For example, bge-large-en-v1.5 has a maximum token limit of 512.”
↩︎ Model limits that rule out a chunk size“If you pass chunks that exceed this limit, they will be truncated, potentially losing important information.”
↩︎ Model limits that rule out a chunk size“Smaller chunks may focus on specific details but lose some surrounding contextual information.”
↩︎ Turning recall and precision drops into chunk-boundary fixes“Larger chunks may capture more context but can include irrelevant information or be computationally expensive.”
↩︎ Turning recall and precision drops into chunk-boundary fixes“Formats such as Markdown or HTML have an inherent structure that can define chunk boundaries (for example, markdown headers).”
↩︎ Turning recall and precision drops into chunk-boundary fixes“it will typically not result in consistent semantically coherent chunks”
↩︎ Turning recall and precision drops into chunk-boundary fixes“If you pass chunks that exceed this limit, they will be truncated, potentially losing important information.”
↩︎ Exam trap 1“Formats such as Markdown or HTML have an inherent structure that can define chunk boundaries (for example, markdown headers).”
↩︎ Exam trap 2“Smaller chunks may focus on specific details but lose some surrounding contextual information. Larger chunks may capture more context but can include irrelevant information”
↩︎ Checkpoint - 2.
“Optimizing without measurement is guesswork.”
↩︎ The re-chunking loop: baseline, one change, re-index, compare“Synthetic evaluation set: Use Databricks synthetic data generation to auto-generate test cases from your documents.”
↩︎ The re-chunking loop: baseline, one change, re-index, compare“Context limits: Must fit within LLM context window when retrieving multiple chunks.”
↩︎ Model limits that rule out a chunk size“Any optimization you try must meet these requirements.”
↩︎ Choosing a strategy with DCG@10 and confidence intervals“Poor parsing (missing tables, broken formatting) directly impacts retrieval quality.”
↩︎ Is chunking really the cause?“Focus on relative improvements as you test different strategies, not absolute scores.”
↩︎ Key concept - 3.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/fundamentals-evaluation-monitoring-ragOfficial docs
“Adjusting any single element can have cascading effects on the others.”
↩︎ The re-chunking loop: baseline, one change, re-index, compare - 4.
“The retrieval parameters (for example, the number of chunks or documents retrieved).”
↩︎ Turning recall and precision drops into chunk-boundary fixes“Retrieval quality can be influenced by both the data pipeline (for example, parsing/chunking strategy, metadata strategy, embedding model) and the RAG chain”
↩︎ Is chunking really the cause? - 5.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/evaluate-assess-performanceOfficial docs
“This is a measure of the completeness of the results.”
↩︎ Turning recall and precision drops into chunk-boundary fixes“A RAG application can respond poorly despite retrieving the correct context; it can also provide good responses based on faulty retrievals.”
↩︎ Is chunking really the cause?“A RAG application can respond poorly despite retrieving the correct context; it can also provide good responses based on faulty retrievals.”
↩︎ Exam trap 4 - 6.
“Databricks recommends using DCG@10 as the primary metric for evaluating overall retrieval quality.”
↩︎ Choosing a strategy with DCG@10 and confidence intervals“Each result contributes a gain of 2^relevance - 1, weighted by a logarithmic discount based on its position.”
↩︎ Choosing a strategy with DCG@10 and confidence intervals“All metrics include 95% confidence intervals computed across per-query values, so you can assess whether differences between strategies are statistically meaningful.”
↩︎ Choosing a strategy with DCG@10 and confidence intervals“Not enough queries for reliable comparison.”
↩︎ Choosing a strategy with DCG@10 and confidence intervals“Two strategies can have the same average score but very different distributions.”
↩︎ Choosing a strategy with DCG@10 and confidence intervals“Embeddings may not capture your domain well.”
↩︎ Is chunking really the cause?“Data quality or relevance issues.”
↩︎ Is chunking really the cause?“DCG@10 captures both how relevant results are and where they appear in the ranking, using the full 0–3 relevance scale.”
↩︎ Exam trap 3“Wide confidence intervals | Not enough queries for reliable comparison. | Increase the number of evaluation queries.”
↩︎ Checkpoint