Start a policy knowledge base with heading-aware chunks around 400 to 600 tokens and a small overlap, provided your embedding model accepts that input. Keep a rule and its exception together; for a model that truncates at 256 word pieces, use a smaller starting budget such as 200 tokens including the heading.
Preserve the unit of meaning before choosing a length
A useful chunk should let someone interpret the fact without guessing which product, policy version or section it belongs to. Begin at headings, paragraphs and list boundaries. Add the document title and section heading to each chunk so “the limit is 12” does not become an orphaned statement with no subject.
Consider a fictional expense policy: “Meals are reimbursed up to $40 per day. For overnight travel in the designated high-cost cities, the limit is $65.” A split between those sentences invites an incomplete answer. Keep the pair together, or make retrieval expand a matched sentence to the full parent paragraph.
Tables need their labels. A row containing “65, overnight, approved” is weak evidence without the column names and relevant note. Preserve the header, row identity and footnotes during extraction. If the parser loses those relationships, tuning vector dimensions will not restore them.
| Document structure | Starting segmentation | Required metadata |
|---|---|---|
| Policy manual | Heading and coherent paragraphs | Policy version, section and page |
| FAQ | Question plus its entire answer | Question identifier and revision |
| Product table | Related rows with headers and notes | Product identifier and table title |
| Long procedure | Step groups with prerequisites | Procedure name and step numbers |
Use these as initial segmentation rules. A fixed token cap is still useful to prevent unexpectedly large sections, but split at a meaningful boundary near that cap rather than cutting a sentence wherever a character counter happens to stop.
Respect the embedding model's actual limit
The sentence-transformers/all-MiniLM-L6-v2 model card documents 384-dimensional vectors and default truncation beyond 256 word pieces. BAAI/bge-m3 documents 1,024 dimensions and an 8,192-token sequence length. Qwen/Qwen3-Embedding-0.6B supports up to 1,024 dimensions and a 32K-token context. These model-card limits were checked on 2026-11-22; choose chunk size within them using coherent source sections.
A 500-token passage is unsuitable for the MiniLM default even though it is small compared with BGE-M3's limit. Silent truncation is especially damaging when the exception sits at the end. Count tokens after attaching titles, source labels and any required prompt prefix.
With Transformers installed, this macOS or Linux Python example counts a proposed BGE-M3 input without truncating it. The first load downloads tokenizer files unless they are cached:
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("BAAI/bge-m3")
heading = "Travel policy / Meals"
paragraph = "Meals are reimbursed up to $40 per day. Overnight exception: $65."
text = heading + "\n" + paragraph
encoded = tokenizer(text, add_special_tokens=True, truncation=False)
print(len(encoded["input_ids"]))
Hugging Face's tokenizer API exposes both add_special_tokens and truncation. Count the complete input your embedding pipeline will use, then reject or split oversize chunks before indexing. Run a second budget check with the generation model's tokenizer when assembling retrieved evidence; the two tokenizers need not produce the same count.
A longer input limit lets you preserve a longer coherent unit when the task needs it. Use smaller units for questions about individual facts, and test retrieval before representing an entire manual with one vector.
Spend overlap where boundaries lose evidence
Overlap repeats source text across neighboring chunks. With a 500-token window and 50-token overlap, the stride is 500 − 50 = 450 tokens. Each full new window adds 450 new tokens and repeats 50. The approximate large-document processing multiplier is 500 / 450 = 1.111, or about 11.1% extra token volume before headings.
For a fictional 10,000-token document, 500-token windows without overlap produce 20 chunks. Stopping when the document is covered, 50-token overlap gives 1 + ceiling((10,000 − 500) / 450) = 23 chunks. At 1,024 float32 values per vector, raw vector storage rises from 20 × 1,024 × 4 = 81,920 bytes to 23 × 1,024 × 4 = 94,208 bytes. Text and index overhead are additional.
Do not solve every retrieval miss by increasing overlap. Five nearly identical hits can crowd a different required passage out of the prompt. Deduplicate overlapping source spans before generation and consider expanding one strong hit to its parent section. Preserve the original offsets so you can merge adjacent evidence cleanly.
Keep the generation evidence budget fixed during comparisons. If one setup retrieves five 200-token chunks and another retrieves five 1,000-token chunks, you changed both segmentation and the amount of evidence the model receives. Compare at a fixed budget such as 3,000 evidence tokens, including headings and citation labels.
Try it on your workload
Choose one policy manual and write ten questions whose answers you can locate. Include a limit whose exception follows in the next paragraph, a table footnote, a definition referenced later and a question about an obsolete version. Mark the complete required evidence for each question.
Using the same embedding model, build three indexes: heading-based chunks without overlap, the same chunks with a 50-token overlap where feasible, and smaller chunks whose retrieval expands to their parent paragraph. For long-input models, start near 500 tokens; for MiniLM, keep the entire encoded input within its 256-token default.
Retrieve under the same 3,000-token evidence budget. Record whether both rule and exception appear, how much duplicate text is included, whether the source can be opened and whether the final answer is correct. Inspect the chunks themselves before blaming generation.
Keep the segmentation version in your index manifest. When a source changes, remove its old chunks and insert the new version as one controlled update. Retain original page or section references so a citation stays useful after the index is rebuilt.
How to decide
- Keep the simplest segmentation that retrieves a rule and its conditions together.
- Reduce chunk size or change models when embedding input is truncated.
- Prefer source expansion or deduplication when overlap fills the prompt with repeated text.
Compare chunks with ten agents for about thirty cents
Ten evaluation agents working in parallel on 1,000 answers on google/gemma-3-27b-it cost about thirty cents in tokens on TrustedRouter at the smaller context budget. On 2026-11-22, the live catalog listed approximately $0.0844 per million input and $0.169 per million output tokens. Each agent handles 100 answers with 3,000 total input and 300 output tokens each: 10 × 100 × 3,000 = three million input and 10 × 100 × 300 = 300,000 output. Cost = 3 × $0.0844 + 0.3 × $0.169 = $0.3039, about thirty cents. Doubling input to 6,000 tokens per answer gives 6 × $0.0844 + 0.3 × $0.169 = $0.5571, about 56 cents.
On one local GPU, those agents share throughput, and requests beyond its parallel capacity wait in line; through a per-token API, independent questions can run at the same time for the same token bill as serial execution. Keep the generator fixed while comparing approved chunking variants, and spend extra context on useful exceptions.
Prices change; check current rates, API setup, agent setup and private API options. Use local generation when source passages must remain on the device.
Sources
- MiniLM model card: dimensions and default input truncation
- BGE-M3 model card: dimensions and sequence length
- Qwen3 Embedding model card: dimensions and context
- Transformers: token counting and truncation controls
- TrustedRouter live model catalog