What is semantic chunking and when does it beat fixed size chunking?
Semantic chunking splits where adjacent-sentence embedding similarity drops, finding topic boundaries instead of token counts. It beats fixed-size chunking on heterogeneous documents and loses on short, uniform ones.
Imagine cutting a long radio show into clips. A clumsy way is to cut every two minutes regardless of what is being said. Some clips will start mid-sentence and stop mid-laugh. A thoughtful way is to listen, notice when the topic changes, and cut there. The clips end up varying in length, but each one is a coherent moment. Semantic chunking is the thoughtful way: it splits text at points where the meaning shifts, using embeddings to detect those shifts automatically. It is more work to set up, but each chunk ends up describing one thing. When the source is short and stays on a single topic, the clumsy cuts work fine and the extra thoughtfulness is wasted.
Detailed answer & concept explanation~4 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define semantic chunking with the adjacent-sentence-similarity algorithm, contrast with fixed-size on both mechanism and outcome, then walk through when each one wins. Anchor the discussion on document heterogeneity as the dominant factor, mention the typical hybrid pattern, and close by noting that empirical evaluation on the actual corpus is the right way to decide.
Real products, models, and research that use this idea.
- LangChain's `SemanticChunker` uses adjacent-sentence cosine similarity drops with a configurable breakpoint percentile to find topic shifts.
- LlamaIndex's `SemanticSplitterNodeParser` follows the same algorithmic idea with a buffered comparison window for noise reduction.
- Anthropic's contextual retrieval skips semantic chunking entirely and instead prepends a generated summary to each chunk at indexing time, recovering the precision lift in a different way.
- Production RAG stacks at companies like Notion and Glean typically combine structural splitting (headings, paragraphs) with semantic chunking only on the long sections that survive structural cuts.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you tune the similarity-drop threshold for a new corpus?
QWhy does hybridising structural and semantic splitters often outperform either alone?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating semantic chunking as universally better. The extra cost of computing per-sentence embeddings and similarity drops only pays back when documents are long, heterogeneous, and have real topic boundaries to find.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.