Why heading structure drives retrieval quality
Chunking pipelines split documents on headings. When a document jumps from an H1 straight to an H4, or leaves paragraphs before the first heading, the chunker either merges unrelated sections or strands text in a context-free chunk. The retrieval system then returns fragments that look relevant but lack their surrounding meaning. Fixing headings is cheaper than tuning embeddings.
The normalization checklist
1) Re-level headings so the document starts at one level and never skips. 2) Give every document a single top-level heading. 3) Move any text before the first heading under an Overview section. 4) Delete empty headings — a heading with no body creates zero-length chunks. 5) Keep heading text unique within a document so chunks carry unambiguous context.
Where the damage usually happens
Converted documents are the most common offenders: PDFs with sidebars produce heading jumps, PowerPoint exports flatten everything to one level, and pasted snippets bring their own level schemes. Running a heading sanity pass right after conversion — before the file enters the pipeline — catches all of these. MarkItDown Online's preview shows the heading tree exactly as the chunker will see it, so a ten-second glance replaces a week of retrieval debugging. Questions: sapsap@qq.com.