Chunk size is a tradeoff: small chunks are precise but can miss context, while large chunks keep context but dilute the match and cost more. The only way to settle it is to measure. In one published benchmark, chunk size had minimal impact on document-level retrieval, with 2K and 40K character chunks performing within a few percentage points of each other. Your documents may behave differently, so test your own sizes on your own questions before deciding.
What you need
- A labelled test set of questions with known correct chunks
- The embedding model you will use
- A way to rebuild the index at different chunk sizes
Step 1: Build three indexes at three sizes
Build one index each at a small, medium and large chunk size, for example 128, 512 and 1024 tokens, using the same embedding model and the same overlap. Keep everything else identical.
Step 2: Measure precision and recall on the same test set
Run every test question against all three indexes with the same top-k. Precision is the share of returned chunks that are relevant; recall is the share of relevant chunks that were returned. Record both, not just one.
Step 3: Pick the smallest size that keeps recall
Choose the smallest chunk size whose recall matches the larger sizes. Larger chunks cost more to embed, store and send to the model, so do not pay for size that buys no retrieval quality.
Worked example: synthetic chunk size test on 4 questions
The table below is a synthetic example. It shows the expected result of testing chunk sizes; no index was built.
| Chunk size | Precision | Recall |
|---|---|---|
| 128 tokens | 0.80 | 0.50 |
| 512 tokens | 0.70 | 0.75 |
| 1024 tokens | 0.60 | 0.75 |
| 2048 tokens | 0.50 | 0.75 |
Expected result (UNTESTED). 512 tokens keeps the same recall as larger sizes with better precision, so it is the pick. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Chunk size matters less when the goal is document-level retrieval rather than finding an exact paragraph.
- The test set decides the winner: a set of short factual questions favours small chunks, while long explanatory questions favour larger ones.
- Recall rises with top-k, so compare sizes at the same top-k or the numbers cannot be compared.
- Changing the embedding model at the same time as the chunk size hides which change mattered.
