Chunk size trades precision against context, and there is no universal best value. Small chunks produce focused embeddings and precise matches, but a single chunk may lack the surrounding context the model needs. Large chunks carry more context per chunk, but their embeddings blur together multiple topics. Fact questions need precision, so they take small chunks; analysis questions need context, so they take larger ones.
Prerequisites
- A sample of the questions your RAG system must answer.
- The documents those questions are answered from.
- A way to run retrieval at two chunk sizes and compare.
Steps
Step 1: Name the question type
Sort your sample questions into fact lookup, such as a date or a name, and analysis, such as comparing two options. Count each kind; the majority type sets your starting size.
Step 2: Set the size band
Use 256 to 512 tokens for fact lookup and 512 to 1024 tokens for analysis. Set overlap to 10 to 15 percent of the chunk size in both cases.
Step 3: Test both bands
Run the same questions against both chunk sizes and count how many get a correct, sourced answer. Keep the band that answers more of your majority question type.
Worked example: Cedar Street Library catalogue questions
The fictional Cedar Street Library tests 8 questions: 5 fact lookups and 3 analysis questions.
| Chunk size | Fact lookup correct | Analysis correct | Total correct |
|---|---|---|---|
| 256 tokens | 5 of 5 | 1 of 3 | 6 of 8 |
| 512 tokens | 4 of 5 | 2 of 3 | 6 of 8 |
| 1024 tokens | 3 of 5 | 3 of 3 | 6 of 8 |
Each size answers 6 of 8 questions, but the 256-token chunks answer all 5 fact lookups, the library’s majority question type, so 256 to 512 tokens is the starting band.
Expected result. You have a measured comparison on your own questions, and the chunk size follows the majority question type. UNTESTED: this guide was not run against a live model or API. The worked example below is fictional practice material, and its result is the expected result, not a measured one.
Limits
- These bands are starting points from retrieval guidance; your documents may need different sizes.
- A small test set can mislead; use at least 20 questions before changing a production chunk size.
- This guide does not cover evaluating the final answer, only retrieval.
