The obvious way to give AI access to a document is to just... give it the document. Paste it in, ask your question, get an answer. For short documents, this works fine. For anything longer, it runs into two separate problems that pull in opposite directions.
The first is the context window. Every AI model has a limit on how much text it can hold in working memory at once. A 200-page contract, a technical manual, a large knowledge base — these exceed that limit. You can't fit them in whole, so something has to give.
The second problem is subtler and matters even when the document fits. Retrieval works by finding the most relevant pieces of content for a given query. If the document is one giant block, the retrieval system has to treat the whole thing as a single unit. It either retrieves all of it or none of it. What you actually want is to retrieve the three paragraphs that are specifically relevant to the question, not the entire 50-page document that happens to contain them. Precision requires smaller pieces.
This is the chunking problem: you need to break documents into pieces, but the size of those pieces involves a real tradeoff. Smaller chunks are more precise but can lose context. A sentence about a contract clause means something different without the surrounding paragraphs. Larger chunks preserve context but reduce precision and can exceed the limits you were trying to work around in the first place.
The strategies that follow are each a different answer to this tradeoff. Chunking strategies covers the general approaches. Recursive chunking breaks documents along their natural structure, respecting headings and sections rather than cutting at fixed intervals. Sliding window chunking overlaps chunks so that content near the boundaries of one chunk also appears in the next, reducing the risk of cutting a thought in half. Parent-child chunking stores chunks at two levels of granularity, retrieving small pieces for precision but passing larger surrounding context to the model for understanding.
None of these are perfect. They're deliberate engineering choices that trade one kind of imprecision for another. Knowing what the tradeoff is helps you pick the right one.


