RAG chunk size and overlap: how to run a useful retrieval experiment
Compare chunking configurations using a fixed question set, evidence coverage, duplicate-aware scoring and answer quality.
Treat chunking as a question-dependent choice
A retrieved passage needs enough context to support an answer without burying the relevant detail. Google Cloud’s RAG transformation documentation identifies chunk size and overlap as configurable ingestion parameters. That does not establish one best configuration for every corpus. Start by identifying the questions your system must answer and the evidence each question requires. A short definition, an exception buried in a policy and a comparison across two sections pose different retrieval tasks. The experiment below is an original design, and its example scores are invented to demonstrate the decision process rather than reproduce a provider benchmark.
Create a fixed evidence-labeled question set
For an illustrative pilot, prepare 60 reviewed questions: 20 direct factual questions, 20 involving an exception and 20 requiring evidence from multiple passages. Record acceptable source spans, document versions and cases where an answer should be withheld. Keep these questions separate from prompt tuning. State whether the sample reflects real traffic or deliberately emphasizes difficult behavior. An evidence label can allow more than one valid passage; do not mark a correct alternative wrong merely because it differs from the first reviewer’s favorite citation. Resolve contested evidence before using the question to rank ingestion configurations.
Change one ingestion factor at a time
Build separate indexes from the same authorized document snapshot. A proposed comparison might use 256-token chunks with 32-token overlap, 512 with 64, and 1,024 with 128. These are experimental candidates, not recommended defaults. Keep the tokenizer, embedding model, parsing method, retrieval count and metadata filters fixed for the initial comparison. Record any truncation or parsing failures. Changing the embedding model while changing the chunk size would make the cause of a result harder to identify. After selecting promising candidates, test additional factors separately and preserve each index configuration with its document manifest.
Score evidence without rewarding duplicate overlap
At a fixed retrieval depth, examine whether the returned passages contain the required evidence. Several overlapping chunks from one paragraph should not count as several independent facts. In a hypothetical comparison, the three configurations cover sufficient evidence for 36, 42 and 40 of the 60 questions: 60%, 70% and about 66.7%. Those numbers do not establish that the middle setting wins in production. Review the question slices, duplicated passages and uncertainty from the small set. A configuration that improves direct lookup while losing policy exceptions may require a different decision from one that improves both.
Inspect the generated answers separately
Use the same generation setup with each candidate and review correctness, support, citation usefulness and appropriate abstention. A passage can be retrieved successfully while the answer ignores its exception or combines it with an outdated rule. Conversely, an apparently correct answer may rely on model knowledge instead of the retrieved evidence. Include a small set of deliberately unanswered questions and verify that the system does not invent a supporting source. Keep retrieval and answer failures separate in the report so the next change addresses the responsible component rather than reflexively increasing chunk size.
Check access and cost before accepting the change
Carry document permissions through ingestion, retrieval and citations, and repeat the access checks against the selected configuration. A more useful passage is still inappropriate if its reader is not allowed to see the source. Record index size, ingestion effort, context volume and response latency alongside evaluation results, using measurements from your own system. Avoid claiming a universal cost saving from one small experiment. The final deliverable should identify the selected configuration, the questions it improved, regressions left open and conditions that trigger another review, such as a new document format or changed question mix.