CertSafari
    Databricks Certified Generative AI Engineer Associate· Lessons

    Domain 3 · Lesson 17/56

    Choosing a chunking strategy from retrieval evaluation

    Select chunking strategy based on model & retrieval evaluation

    15 min read
    2.31% of exam
    6 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    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:

    1. Measure the current pipeline and record its retrieval metrics as the baseline.
    2. Re-chunk the corpus with exactly one change: a new strategy, a new size or a new overlap.
    3. 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.
    4. 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.

    Suggested starting chunk sizes for an experiment. Each size is a separate run against the same evaluation set.python
    # Common configurations to test
    small_chunks = 256   # Better for precise fact retrieval
    medium_chunks = 512  # Balanced approach
    large_chunks = 1024  # More context per chunk

    Checkpoint 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?

    Sources123

    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?

    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?

    Sources12

    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.

    Reading retrieval metrics as chunking problems
    What the metrics showLikely chunking causeChange to test next
    Recall drops: relevant material is missing from the top-kChunks are too small, or boundaries split one idea across two chunksSplit on the document's own structure, or add overlap between adjacent chunks
    Precision drops: retrieved chunks are mostly off-topicChunks are too large or noisy, so one chunk covers several subjectsUse smaller or more semantically coherent chunks
    Retrieved chunks hold half of the answerA fixed token count cuts through a logical unitUse 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.

    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?

    Sources145

    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.

    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?

    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?

    Sources62

    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.

    Sources5426

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “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. 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. 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?
    4. 5.
      “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
    5. 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

    Spotted a mistake, or was something unclear? Tell us.