The unit of retrieval is the unit of failure
A retriever returns chunks, not documents, so the chunk is what the model gets to read and what it has to answer from.
- : the document length in tokens.
- : the chunk size.
- : the overlap between consecutive chunks.
Too small and a chunk arrives without the context that makes it mean anything. Too large and the embedding averages several topics into one vector that matches none of them well.
That range is the usual compromise, and it exists because embedding models were trained on passages of roughly that length.
Why overlap is not optional
A fixed cut lands in the middle of a sentence, a table or an argument, and whichever half holds the answer may not hold the words the query matches.
An overlap of ten to twenty percent means any span shorter than the overlap appears whole in at least one chunk.
The cost is duplication: 20 percent overlap stores 25 percent more vectors and returns near-duplicate results that then have to be deduplicated.
Splitting on structure rather than on length
- Split on the largest natural boundary first, such as a section heading.
- If a piece is still too long, split it on paragraphs.
- If still too long, split on sentences.
- Only then split on tokens, which is the last resort.
- Merge any piece far below the target into its neighbour.
That cascade is what recursive splitting does, and it beats fixed-size cutting on every document that has structure.
Code, tables and transcripts each want their own rule. A function cut in half retrieves badly, and a table separated from its header is unreadable to the model.
The budget it has to fit
- : how many chunks are retrieved.
- : the model's context window.
Chunk size and the number of chunks trade directly against each other under a fixed budget, so the real decision is rather than either alone.
Many small chunks give better recall and more duplication. Few large ones give more context per hit and waste tokens on irrelevant text around the answer.
The fix that removes most of the trade
Embed the small chunk and return the large one.
Parent document retrieval indexes fine-grained chunks for matching and hands the model the larger passage that contains the winner.
Contextual retrieval goes further and writes a sentence of document context onto each chunk before embedding it.
That repairs the dangling pronoun and the missing subject that a mid-document chunk always has.
Both accept extra work at indexing time to avoid a decision that cannot be made well at query time, and both are worth more than tuning .