Benchmarks/Chunking
Chunk size sweep: 200 to 2,000 characters
How big should RAG chunks be?
0.877best strict hit@1 (heading-aware, 200 chars)
Short answer: How you cut matters more than how big. Fixed-size chunks fell from 0.583 to 0.161 strict hit@1 as they grew from 200 to 2,000 characters. Heading-aware chunks only fell from 0.877 to 0.757.
- Fixed
- Heading-aware
- Fixed
- Heading-aware
What the numbers say
- Fixed-size chunks crossed a section boundary 22.5% of the time at 200 characters and 81.3% at 2,000.
- Heading-aware chunks never crossed a section, at any size.
- On the lenient metric (any chunk from the right page counts), sizes above about 400 characters scored within a few points of each other.
All results
| Fixed | 200 | 8,179 | 198 | 22.5% | 0.583 | 0.810 | 0.674 | 0.583 | 0.810 |
| Fixed | 400 | 4,119 | 393 | 38.9% | 0.503 | 0.758 | 0.602 | 0.700 | 0.908 |
| Fixed | 600 | 2,766 | 585 | 50.9% | 0.447 | 0.700 | 0.548 | 0.730 | 0.931 |
| Fixed | 800 | 2,086 | 774 | 59.8% | 0.391 | 0.602 | 0.475 | 0.736 | 0.949 |
| Fixed | 1,200 | 1,416 | 1,139 | 70.8% | 0.292 | 0.448 | 0.354 | 0.736 | 0.941 |
| Fixed | 1,600 | 1,083 | 1,486 | 76.8% | 0.197 | 0.321 | 0.247 | 0.734 | 0.937 |
| Fixed | 2,000 | 884 | 1,818 | 81.3% | 0.161 | 0.238 | 0.193 | 0.745 | 0.935 |
| Heading-aware | 200 | 6,367 | 229 | 0.0% | 0.877 | 0.981 | 0.921 | 0.511 | 0.862 |
| Heading-aware | 400 | 3,980 | 367 | 0.0% | 0.822 | 0.977 | 0.887 | 0.744 | 0.918 |
| Heading-aware | 600 | 3,149 | 464 | 0.0% | 0.799 | 0.972 | 0.872 | 0.741 | 0.924 |
| Heading-aware | 800 | 2,739 | 533 | 0.0% | 0.785 | 0.964 | 0.858 | 0.734 | 0.922 |
| Heading-aware | 1,200 | 2,398 | 609 | 0.0% | 0.763 | 0.960 | 0.846 | 0.730 | 0.932 |
| Heading-aware | 1,600 | 2,250 | 649 | 0.0% | 0.761 | 0.956 | 0.843 | 0.736 | 0.936 |
| Heading-aware | 2,000 | 2,176 | 671 | 0.0% | 0.757 | 0.956 | 0.840 | 0.739 | 0.942 |
Setup
FastAPI English docs (152 Markdown files, 1.46M characters), 781 heading queries, BM25 (k1=1.5, b=0.75), Python 3.12, standard library only. No embeddings were tested. Script and raw output are in the Experiment files box.