RAG and Knowledge Engineering
Chunking Strategies — Stack
Chunking strategies › Stack
Technology landscape as of 2026-10-10. Knowledge cutoff May 2026.
Selection criteria
Most of this is configuration rather than procurement, so the criteria are about what a library makes possible and what it quietly prevents.
- Structure awareness. Whether the splitter can consume a typed element tree with heading levels, or only a string. A string-only splitter cannot respect a section boundary it cannot see.
- Token-accurate measurement. Whether lengths are measured with the encoder's own tokeniser or with a character approximation, since the approximation is what silently exceeds the limit.
- Atomic-region protection. Whether tables, code fences, list groups and figure captions can be declared unsplittable.
- Parent-child support. Whether the output can record the relationship between an indexed span and the larger region that should be returned with it.
- Deterministic and stable boundaries. Whether the same input yields the same units, and whether a local edit changes only local units.
- Metadata propagation. Whether document title, heading path, page anchors and source identifiers are carried onto every unit without extra plumbing.
- Format-specific handling for markup, source code, transcripts, spreadsheets and email threads, each of which has boundaries that generic prose rules get wrong.
- Cost of the policy itself. Model-assisted boundary selection is a per-document inference cost that recurs on every reprocess.
Options
| Option | Best for | Watch out for |
|---|---|---|
| Recursive character or token splitters (LangChain text splitters, LlamaIndex node parsers) | A working baseline in an afternoon, over any text | Separator lists are prose-shaped; measure lengths with the real tokeniser or expect silent truncation |
| Structure-driven splitting on a parsed element tree (Unstructured chunking by title, Docling's document-aware splitting) | Corpora of well-structured documents with reliable headings | Only as good as the parser's heading detection; flat documents degrade to fixed-size behaviour |
| Semantic splitting by embedding-similarity boundary detection | Unstructured prose with no usable headings | Costs an encoding pass over every sentence at build time, and boundaries shift when the model changes |
| Parent-document and small-to-big retrieval (LlamaIndex auto-merging and sentence-window retrievers, LangChain parent-document retriever) | Precision in matching with enough context in the returned text | Requires a document store alongside the index and a merge policy for overlapping parents |
| Late chunking over long-context encoders | Keeping document-level context inside each unit's representation | Needs an encoder with a long sequence limit and a store that accepts the resulting vectors |
| Language-aware code splitters (tree-sitter-based splitting) | Source repositories, where the function or class is the natural unit | Grammar coverage per language varies; generated and minified files need separate handling |
| Transcript-specific segmentation by speaker turn or topic shift | Meeting, call and video corpora | Turn-level units are too small to retrieve alone; grouping rules need timestamps preserved |