Chunking settings are the part of a RAG deployment most often chosen by copying a number from a tutorial. They are also the part that most changes what users see. A chunk that is too small finds the right sentence and loses the context that makes it mean something; a chunk that is too large drags in so much surrounding text that the model has to guess which part answers the question.
This guide is a practical way to choose with your own documents. It refers to InsightRAG's extraction profile, but the method works for any RAG system.
What the settings trade off
| Setting | Smaller / off | Larger / on |
|---|---|---|
| Chunk size | Precise matches, but a clause can lose its heading, definitions or exceptions. | More context per chunk, but each chunk is about more things, so similarity is blurrier and fewer chunks fit in the prompt. |
| Overlap | No repeated text; a sentence on a boundary may be split. | Boundary sentences survive; more chunks and more storage for the same document. |
| Markdown format | Plain text: simple, fine for prose. | Headings, lists and tables kept as structure, and chunks split along headings carry them as metadata. |
| Layout model | Faster and cheaper; text order as the PDF stores it. | Better on multi-column pages, forms and boxed schedules; slower and costs model calls. |
Starting points by document type
These are places to start the test below, not answers:
- Structured documents with headings (policies, procedures, contracts, product guides): Markdown, split by heading. The heading split does most of the work; size and overlap only matter for very long sections.
- Long narrative documents (reports, memos, case files): larger chunks with a meaningful overlap, so an explanation stays with its conclusion. InsightRAG's direct-upload path uses 5,000 characters with a 1,000-character overlap for exactly this kind of material.
- Short items (tickets, messages, FAQ entries): one item per chunk where possible; splitting a ticket rarely helps.
- Forms and schedules (declarations pages, rate tables): try the layout model on a sample; compare with plain extraction before paying for it across the whole corpus.
The side-by-side test
- Write twenty questions you can answer. Pick them with the people who will use the system, across document types and years. Note the answer and the page it is on.
- Choose two or three profiles that differ in one thing. For example: Markdown by heading versus plain text at the same size; or 1,000 versus 3,000 characters with the same overlap.
- Load the same sample into a separate test index per profile. A few hundred documents is enough; use the same embedding model for all of them.
- Ask every question of every index with the same agent and filters, and score two things: is the answer right, and does the cited chunk actually support it?
- Choose, then freeze. Put the winning profile in the production workflow and keep the questions; rerun them whenever the profile, the embedding model or the document mix changes.
Reading the results
- Right answer, wrong citation usually means chunks are too large: the model found the answer in a chunk that is mostly about something else.
- Wrong answer, nearly-right citation often means chunks are too small or split badly: the cited chunk is next to the one that matters. Try Markdown splitting or more overlap.
- No relevant chunk at all is usually extraction (an empty scanned page, a scrambled table) or metadata (a filter excluding the right document), not chunk size.
- Good answers for one document type, poor for another suggests separate workflows with separate profiles, which is easy when each source is its own workflow.
One more lever sits outside the profile: retrieval keeps only strong matches (a score of 0.75 or more where the store returns scores) and gives chat agents the top five. If the right chunk is consistently sixth or seventh, better chunks will help more than asking for more of them. See how retrieval works.
Characters, not tokens
Chunk size and overlap in an extraction profile are measured in characters. Models count tokens, and for English text a token is very roughly four characters, so a 5,000-character chunk is in the region of a thousand-plus tokens. The arithmetic that matters is the prompt: chat agents pass the top five chunks, so at 5,000 characters each a question can bring around 25,000 characters of context to the model. At 1,000 characters the same five chunks are a fifth of that, cheaper and more focused, but each one carries much less of its surroundings.
A worked comparison
Two profiles on one set of claim guidelines
The fictional Brindle Assurance claims team has a set of claims-handling guidelines: long documents, clear numbered headings, and definitions at the front that later sections depend on. They load the same sample twice: a markdown profile split by heading, and a text profile at a large size with overlap. They ask their twenty questions of both. Questions about one procedure step do better under the heading split, because each chunk is one step with its heading attached. Questions that depend on a definition from the front of the document do better under the large chunks, which sometimes catch the definition and the step together. They keep the heading split and add the definitions as their own short document, so they are retrieved on their own.
The organisation and its documents are made up; the point is the method, not a result.
How to decide, in short
- If the documents have real headings, start with Markdown and let the headings do the splitting.
- If answers need context from far away in the document (definitions, conditions), consider pulling that context out as its own document rather than making every chunk bigger.
- If citations are vague, go smaller; if answers miss conditions, go larger or add overlap.
- Change one setting at a time and rerun all the questions.
Questions people ask
Do we have to reload everything after changing the profile?
Yes, for the documents the change affects: chunks are made at ingestion, so new settings only apply to documents extracted under them. That is why the test runs on a sample in separate indexes first.
Can the number of chunks given to the model be changed?
Not per request in chat today: chat agents use the top five. The standalone search API lets the caller choose how many chunks to return.