Structure-Aware Chunking
In this article
- Predict what a size-only cut does to a table, a figure caption and a section heading.
- Sketch a chunker that walks parsed blocks, keeps each one whole and splits only a block over the size limit, by a rule that fits its type.
- Say which metadata every chunk needs, from its heading path to its source and pages, and why.
- Explain why structure comes first and when a model-based boundary method has to prove it does better.
- Terms defined here: structure-aware chunking, heading path.
Overview
A splitter that counts tokens cuts wherever the count runs out. On a manual it can cut a table in half, so the second half of the rows reaches the search index as its own chunk with no column names and no sign of which section it came from. A question about one of those codes then finds the right row in a chunk that reads like noise.
The router manual manual-bl-r7 of Brightline, the made-up internet provider, has exactly that kind of table. Follow it through chunking that works from the document's own pieces, its headings, paragraphs, tables and captions, and cuts by size only where one piece is too big. Afterwards you can sketch that chunker, list the metadata each chunk needs, and say why this cheap rule is the baseline any smarter method has to beat.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- Where a size-only cut breaks
- Start from the blocks
- The heading path
- When one block is too big
- What each chunk carries
- Where structure misleads
- The rule at work
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions