Article chapter 04 of 08
Chunk around meaning and where it came from
Chunking decides what the retriever can hand to the model. Fixed character windows are easy to build, but they can separate a heading from its rule, a table row from its columns or an exception from the instruction it qualifies.
Start with whatever structure the source gives you: headings, paragraphs, list items, table boundaries and page references. Keep the title and heading path with each chunk, so a passage from "Cancellation" isn't shown without the policy or product it belongs to.
Check chunk size against the questions people actually ask. A very small unit can match a term precisely and still leave out conditions in the next paragraph. A large one carries more context but can dilute the match and fill the context window with irrelevant text. Overlap helps at the boundaries, although too much gives you near-duplicate results that push other sources out.
Different formats want different rules. A short procedure step might need its prerequisites and warning, a long policy section might split at subheadings, a table could be indexed by logical rows with the column names repeated, and a question-and-answer page might work as one pair per chunk. Store the chunking strategy and its version so you can reproduce results during evaluation.
Keep the source location in a form the user can follow: page number for stable PDFs, a heading path and anchor for a web page, sheet and range for a spreadsheet. A nice-looking citation label that doesn't lead back to the evidence is no use to anyone.
Navigation, confidentiality notices, footers and copied introductions can dominate similarity search, so strip known layout noise during normalisation while keeping anything that changes the document's meaning or status. De-duplication should flag exact and near-exact copies for review instead of deciding on its own which version is authoritative.
Then look at the chunks themselves before tuning retrieval. Read a sample without the surrounding document and ask whether each passage says what it's about, keeps its conditions and could support a citation, paying attention to the ones around headings, page breaks, lists and tables. A lot of what looks like model failure starts with text that was split or extracted badly.