Writing · 16 November 2026 · 5 min read
What chunking actually does to your RAG answers
Split the same policy document three ways and the same question gets a right or a wrong answer. A small script you can run, what the defaults really are, and how to test chunking on your own files.
Ask a support bot whether an opened software licence can be refunded, and it says yes, within 30 days. The policy says the opposite. Nothing is wrong with the model. It was handed the wrong 200 characters.
That is chunking. Before a RAG system (retrieval-augmented generation: the bot looks up passages from your documents, then answers from them) can search anything, it cuts every document into pieces. Search returns pieces, not documents. If the sentence that matters got cut in half, or landed in a different piece from the rule it qualifies, the model never sees it. It answers confidently from what it was given.
A test you can run in five minutes
You can see this without any vendor or API key. Take a 910-character customer policy in Markdown with four sections: refunds, shipping, warranty and returns, where each section has a main rule and an exception. The refunds section, for example, says refunds are allowed within 30 days, then in the next paragraph says opened software licences are not refundable once the activation key is revealed, "even inside the 30-day window."
Split it three ways with the langchain-text-splitters package (version 1.1.3), ask five questions, and check whether the single best-matching chunk contained the answer. Retrieval here is plain BM25 keyword scoring from the rank_bm25 package, not embeddings, so it runs anywhere. The three splits:
fixed = RecursiveCharacterTextSplitter(chunk_size=200, chunk_overlap=0, separators=[""])
overlap = RecursiveCharacterTextSplitter(chunk_size=200, chunk_overlap=60)
by_heading = MarkdownHeaderTextSplitter([("#", "h1"), ("##", "h2")])
Fixed-size splitting got 4 of 5. Splitting with overlap got 5 of 5. Splitting by heading got 5 of 5.
Where it broke
The one miss is the interesting part. With hard 200-character cuts, the first chunk ends like this:
...usually take 5 to 7 business days to appear.\n\nOpened software lic
The next chunk starts with ences are not refundable. The word "licence" no longer exists in either chunk. So the question about refunding an opened licence matches the first chunk best. That chunk shares "refund", "opened" and "software" with the question, while the second one only has "refundable" and a broken word. And the first chunk contains only the permissive rule. A model reading it would say yes. That is the opening example, and it came out of an honest search over an honest document.
Fixed cuts did the same to the warranty section. One chunk ends with "from the delivery da" and the next starts with "te." The battery question still happened to hit, because the battery sentence survived whole. Luck, mostly.
The recursive splitter avoids this by trying to break on paragraph breaks first, then line breaks, then spaces, and only then mid-word. LangChain's docs list that default order as ["\n\n", "\n", " ", ""]. The 60-character overlap means a sentence near a boundary appears in both neighbouring chunks.
Splitting by heading kept every rule next to its exception, because each section became one chunk. On a toy document that is the obvious winner. On a real one it often isn't. A 40-page contract can have a single section that runs for six pages, and a heading split will hand you one enormous chunk. LlamaIndex's docs suggest exactly this pattern: use a file-aware parser like the Markdown one first, then a text splitter to keep pieces within a size limit.
The defaults are not neutral
A lot of RAG code never sets chunk size at all. It is worth knowing what you get. In the installed versions checked on 9 November 2026:
- LangChain's base
TextSplitterdefaults tochunk_size=4000andchunk_overlap=200, and its length function is Python'slen, so that is 4,000 characters, not tokens. - LlamaIndex's
SentenceSplitter(llama-index-core 0.14.25) defaults to 1,024 for chunk size with an overlap of 200, measured in tokens.
Those are very different chunks. In the test policy above, one token averaged about 4.7 characters, so 1,024 tokens would be close to 4,800 characters. The "same" setting of about a thousand means a paragraph or two in one library and most of a page in the other. If you move a project between libraries and keep the number, you have changed your chunking without noticing.
There is also a ceiling. OpenAI's embeddings guide lists a max input of 8,192 tokens for text-embedding-3-small and text-embedding-3-large, and points to tiktoken with the cl100k_base encoding for counting. That limit is rarely the real constraint, though. The bigger cost of large chunks is that one vector has to stand for everything in them, and a single exception buried in a long passage gets averaged away.
What this test does not prove
This was a 910-character document, five questions and keyword search. Embeddings, rerankers and an actual LLM answer were not part of it. Embedding search behaves differently from BM25, and semantic splitters that pick break points by embedding similarity exist too, and those weren't tested here either. The 5 of 5 scores mean "nothing broke on a document built to be easy," not "this setting is right."
The broken cut, though, is not a quirk of the toy. Any splitter that cuts on a fixed count with no regard for words or sentences will do it somewhere in a real corpus, and you won't see it unless you look.
Try it on one real document
Pick the document your users ask about most, such as a returns policy, an SOP or a price sheet. Write five questions whose answers you already know, and make at least two of them about exceptions, because exceptions are what get separated from their rules. Chunk the document three ways: your current setting, a recursive split with some overlap, and a split on headings. For each question, print the top three chunks and check by eye whether the answer is in them.
If your current setting loses an exception that another split keeps, you have found a wrong answer your bot is already giving. Fix that before you change the model or the prompt.
explainer
Found this useful? Pass it on.