Skip to main content

Chunking Strategies for RAG, Measured

Published on · In Software Engineeringby

Chunking Strategies for RAG, Measured
Chunking Strategies for RAG, Measured

Chunking is how a retrieval-augmented generation (RAG) system cuts its documents into the pieces it searches. When a question comes in, the system embeds it (turns it into a vector, a list of numbers that places similar meanings close together), finds the nearest chunks, and hands those to the model as context. The model can only answer from what it is handed, so the cut decides the ceiling on every answer before any model runs.

This post opens a series that builds one retrieval system over this blog, one layer per post. The corpus is the 23 posts published before this one, about 31,600 words, and the test is 80 questions written in a reader's words, each with the exact passage that answers it. Six chunking strategies were run against the same questions with the same embedding model. Cutting every 200 words put the answering passage in the top five results for 73.8% of questions. Searching 50-word pieces and returning the 200-word section around them reached 95.0%, the same as sending whole posts, while sending a ninth as many words.

In the full article

Steven Brown in Milan
Steven Brown

Let's Connect

If you've journeyed this deep into my site, you're exactly who I want to connect with — whether it's about a fresh project or just a friendly chat. Feel free to reach out through social media or my contact page.