Semantic and Structure-Aware Chunking
Structure-aware chunking respects headings, paragraphs, lists, tables, and code blocks. Hierarchical splitting first uses high-level boundaries, then subdivides oversized sections. Store parent section IDs so a small child chunk can be expanded when its context is needed.
Model-based semantic splitting can help detect topic changes but adds cost and may be inconsistent. Compare it against a simpler baseline on representative questions. Preserve exceptions and definitions with the rules they qualify.
Implementation example
{
"documentId":"api-guide",
"parentSectionId":"authentication",
"headingPath":["Security","Authentication","Token expiry"],
"chunkIndex":4
}💡 Parent references enable contextual expansion and source traceability.
Key Takeaways
- Inspect the relevant pipeline stage instead of guessing.
- Preserve source provenance, versions, and access scope.
- Measure quality on representative queries.
Knowledge Check
Why keep a parent section ID?