{ "@context": "https://schema.org", "@type": "WebPage", "@id": "https://www.initiumstrategies.com/glossary/semantic-chunking-windowing#webpage", "name": "Semantic Chunking & Windowing", "description": "Splits unstructured text into context-preserving chunks and windows so retrieval gets coherent, citable spans. ", "url": "https://www.initiumstrategies.com/glossary/semantic-chunking-windowing", "inLanguage": "en", "dateModified": "2026-09-18T14:13:00.747Z", "datePublished": "2026-09-18T14:13:00.747Z", "isPartOf": { "@id": "https://www.initiumstrategies.com/#website" }, "publisher": { "@id": "https://www.initiumstrategies.com/#organization" }, "mainEntity": { "@type": "DefinedTerm", "@id": "https://www.initiumstrategies.com/glossary/semantic-chunking-windowing#term", "name": "Semantic Chunking & Windowing", "description": "Splits unstructured text into context-preserving chunks and windows so retrieval gets coherent, citable spans. ", "url": "https://www.initiumstrategies.com/glossary/semantic-chunking-windowing", "inDefinedTermSet": { "@id": "https://www.initiumstrategies.com/glossary#termset" } } }
Semantic chunking splits unstructured text into coherent spans; windowing keeps neighboring context so retrieved passages stay readable and complete. This is useful when models need quotable units rather than whole documents or broken sentence fragments.
Whilst “smart chunking” sounds solved, in practice bad boundaries orphan a claim from its proof. For example, a definition lands in one chunk and the exception in the next, so the assistant quotes half the rule. We often recommend chunking by document structure and workflow need — with overlap or parent windows — and re-chunking when templates change, not one global splitter for every file type.
Models retrieve chunks, not whole documents. Bad splits orphan definitions from proof; oversized chunks waste context and dilute similarity. Semantic chunking respects structure and topical boundaries; windowing (sliding overlap or parent–child retrieval) restores surrounding sentences when a hit is borderline. Token budgets and embedding limits constrain the design. Track chunk-level hit rates in evals; treat re-chunking as a release, not a silent tweak.
def window_chunks(paragraphs: list[str], size: int = 3, stride: int = 2) -> list[str]:
"""Parent windowing: overlapping paragraph groups preserve local context."""
out = []
for i in range(0, max(len(paragraphs) - size + 1, 1), stride):
out.append("\n\n".join(paragraphs[i : i + size]))
return out or ["\n\n".join(paragraphs)]